I have a NoteBrief
public int Id { get; set; }
public string Title { get; set; }
public DateTime Created { get; set; }
public int ParentNoteId { get; s
Entity Framework creating IQuerable of the most recent
This is what finally worked for me:
return from e in _ctx.Notes
group e by e.ParentNoteId into g
select g.OrderByDescending(e => e.Created).FirstOrDefault() into r
select new NoteBrief
{
Id = r.Id,
Title = r.Title,
Created = r.Created,
ParentNoteId = r.ParentNoteId,
};
Also edited my original post with correct query i was going for.
Thanks.