I am using entity framework core. I am eager loading a navigation property for an entity. What I want to achieve here is only load top 5 records ordered by creation date along with the main entity. I have following query.
Context.Foo.Where(f => f.Id == fid)
.Include(f1 => f1.Bars.OrderByDescending(b => b.CreateDate).Take(LIMIT))
.FirstOrDefault();
It throws error that property expression is not valid. I understood that the expression should just evaluate to a property we want to include, but is there a way where we can fine tune the selection of properties?