Entity Framework Classic Query Include Optimized
The EF Query Include Optimized feature let you filter related entities that will be included. However, instead to make one big query like Query Include Filter, the queries are split in several queries to optimize the performance like
EF Core does.
The feature works exactly like Query Include Filter, but you use the
IncludeOptimized method instead.
The query is split in multiple queries which reduce the amount of data transferred.
var customers = context.Customers.IncludeOptimized(x => x.Invoices.Where(y => !y.IsSoftDeleted)).ToList();
The Query Include Optimized feature may sometimes reduce the performance. For example, when some database indexes are missing.
To use this feature, you need to download the following NuGet Package
Entity Framework Classic - Integration
The Query Include Optimized feature will eventually integrate directly in Entity Framework Classic.
It's planned that this feature gets a major revamp to work more easily with include methods such as
||Gets or sets if queries should be batched (executed in the same SQL Command)||
||Gets or sets if include path should be included automatically.||