Entity Framework Core 3.0 new features - filtered include

asp.net-core entity-framework-core

Question

Following this problem with filtering Include in EF Core:

stackoverflow question

is this something that will be possible in EF 3.0?

1
0
9/24/2019 11:53:53 AM

Expert Answer

By default, EF Core doesn't support to filter in the Include method.

Disclaimer: I'm the owner of the project Entity Framework Plus

The EF+ Query IncludeFilter (free and open source) allows easily filter included entities.

The ThenInclude is not yet supported but you just have to include the last filter to have the same behavior.

Example:

_dbContext.User
    .IncludeFilter(x=>x.UserRoles)
    .IncludeFilter(x=>x.UserRoles.SelectMany(y => y.Roles.Where(z => z.Active)))
0
9/25/2019 12:54:12 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow