I am trying to filter three child levels down and find only child elements where PropertyMailingAddress.Status== True.
How do I convert filter three levels down and con
You cannot mixte Include
with IncludeFilter
.
In EF Core, the IncludeFilter
should automatically add all paths.
We don't have the class definition so it makes it hard to know exactly the relationship but the query should look like this:
var result = await db.Property.IncludeFilter(pm => pm.PropertyParty
.Select(x => x.Party)
.SelectMany(x => x.PartyMailingAddress)
.SelectMany(x => x.PropertyMailingAddress.Where(z => z.Status == true)).ToListAsync();
The filtering is done in the database. So be careful with EF Core 2.x, as their have a client side evaluation they removed in EF Core 3.x which was causing some problem.
If you need more help, just provide a runnable solution in our issue tracker: https://github.com/zzzprojects/EntityFramework-Plus/issues