EF6 Query to latest EF Core could not be translated

跟風遠走 提交于 2020-12-15 06:14:38

问题


I have created a query that allows group messages based on the reference number and chose each group's latest record.

var list = _context.Messages.Include(m => m.SenderId).Include(m => m.ReceiverId)
.Where(m => m.Status != MessageStatus.Archived)
.OrderByDescending(m => m.DateAdded)
.GroupBy(m => m.Reference)
.Select(g => g.OrderByDescending(m => m.DateAdded).FirstOrDefault()).ToList();

Can someone suggest how to convert this to EF Core?

来源:https://stackoverflow.com/questions/64836474/ef6-query-to-latest-ef-core-could-not-be-translated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!