问题
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