Query Include Optimized
The EF Query Include Optimized feature let you to filter related entities that will be included. However, instead to make one big query like Query Include Filter, the queries is split in several queries to optimize the performance like
EF Core does.
The feature work exactly like Query Include Filter, but you use the
IncludeOptimized method instead.
The query is split in multiples 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 index are missing.
To use this feature, you need to download the following NuGet Package
Entity Framework Classic - Integration
The Query Include Optimized feature will be eventually integrated directly in Entity Framework Classic.
It's planned that this feature get 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.||