0

I am not getting filtered record as expected as mentioned in below query. Also I need to perform this as Queryable

I have tried using Include and tried to filter it with Where inside Include itself as a subquery. But of no success.

query.Where(task => ( task.Audit.OrderBy(t => t.OccurredAt).Take(1).Any(p=> (DateFrom.HasValue? p.OccurredAt>= DateFrom:true ) && (DateTo.HasValue? p.OccurredAt <=DateTo:true))));

Here query is a Queryable expression!!

Expected: Need to get the filtered date as per Date range given in Iqueryable format
Actual: Getting all records

Spears
  • 2,102
  • 1
  • 17
  • 27
  • I assume you are using some (what?) version of Entity Framework? – NetMage May 15 '19 at 18:20
  • Possible duplicate of [How to filter "Include" entities in entity framework?](https://stackoverflow.com/questions/39636952/how-to-filter-include-entities-in-entity-framework) – NetMage May 15 '19 at 18:28

0 Answers0