I have an object Customer
with a one-to-many
relation to Visit
.
The visits have certain VisitType
.
I want to fetch only Visits
after a certain date and this for all my Customers
. Therefor i pass the parameter referenceDate
Linq query i can think of that would give me the desired result:
customers.Include(c => c.Visits.Where(v => v.VisitDate >= referenceDate)).ToList();
Offcourse this does not work since Include
actually requires a path.
Is there a Linq alternative for this problem or should i write custom queries for this?