Here's a summary of what's new in Entity Framework Core in this preview release:
Entity Framework Core 10 updates:
EF's global query filters feature has long enabled users to configuring filters to entity types which apply to all queries by default. This has simplified implementing common patterns and scenarios such as soft deletion, multitenancy and others. However, up to now EF has only supported a single query filter per entity type, making it difficult to have multiple filters and selectively disabling only some of them in specific queries.
EF 10 introduces named query filters, which allow attaching names to query filter and managing each one separately:
modelBuilder.Entity<Blog>()
.HasQueryFilter("SoftDeletionFlter", b => !b.IsDeleted)
.HasQueryFilter("TenantFilter", b => b.TenantId == tenantId);This notably allows disabling only certain filters in a specific LINQ query:
var allBlogs = await context.Blogs.IgnoreQueryFilters(["SoftDeletionFlter"]).ToListAsync();For more information on named query filters, see the documentation.
This feature was contributed by @bittola.
- Implemented
DateOnly.DayNumbertranslations (#36189). - IQueryExpressionInterceptor leaks across contexts, leading to incorrectly-used cached queries (#36127).
- Support entity splitting with owned JSON entities (on main table) (#36145).
The full list of issues completed for Preview 6 can be found here.