EF6 Query to latest EF Core could not be translated
Asked Answered
D

0

0

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?

Decagram answered 14/11, 2020 at 17:10 Comment(2)
I see you have a lot or reputations and certainly know that you have to show the error message . Only after this people can help you.Raceme
try the updated answer at this question: #64834681Lenrow

© 2022 - 2024 — McMap. All rights reserved.