Plan for Entity Framework Core 7.0
As described in the planning process, we have gathered input from stakeholders into a plan for Entity Framework Core 7.0 (EF Core 7.0.) For brevity, EF Core 7.0 is also referred to as just EF7.
This plan is not a commitment; it will evolve as we continue to learn throughout the release. Some things not currently planned for EF7 may get pulled in. Some things currently planned for EF7 may get punted out.
EF Core 7.0 is the next release after EF Core 6.0 and is currently scheduled for release in November 2022 at the same time as .NET 7. There are no plans for an EF Core 6.1 release.
EF7 currently targets .NET 6. This may be updated to .NET 7 as we near the release. EF7 does not target any .NET Standard version; for more information see the future of .NET Standard. EF7 will not run on .NET Framework.
EF7 will align with the .NET support policy and will therefore not be a long-term support (LTS) release.
EF7 will contain a small number of breaking changes as we continue to evolve both EF Core and the .NET platform. Our goal is to minimize breaking changes as much as possible.
The large investments in EF7 will fall mainly under the following themes:
- Highly requested features
- NET platforms and ecosystem
- Clear path forward from EF6
Each of these themes is described in detail below. The high-level status of each theme can be tracked in the EF Core biweekly updates. Please comment on GitHub Issue #26994 with any feedback or suggestions.
Theme: Highly requested features
As always, a major input into the planning process comes from votes (👍) for features on GitHub. Based on these votes in addition to other factors, we plan to work on the following highly requested features for EF7.
Value proposition: Save and query into JSON-based documents stored in relational database columns.
This feature will introduce a common mechanism and patterns for JSON support that can be implemented by any database provider. We will work with the community to align existing implementations for Npgsql and Pomelo MySQL, and also add support for SQL Server and SQLite.
Value proposition: Efficient, predicate-based updates for many database rows without loading data into memory.
Change tracking followed by SaveChanges is the primary mechanism in EF Core for inserting, updating, and deleting entities. This mechanism ensures that database operations are ordered to satisfy constraints, and that tracked entities are kept in sync with the changes made to the database. However, it requires a database roundtrip to load entities into memory in order to create the appropriate database commands, followed by a database roundtrip to execute these commands.
In contrast, bulk, or set-based, updates involve defining the changes that should be made to the database and then executing those changes without first loading entities into memory. This can be significantly faster than tracked updates, especially when the same modification must be applied to many different entities/rows.
For EF7, we plan to implement bulk updates and deletes (but not inserts). Note that bulk updates is not the same as batching updates. EF Core already combines changes to many tracked entities into batches when sending updates to the database via
Tracked by Issue #626: Lifecycle hooks
Value proposition: Allow applications to react when interesting things happen in EF code.
Lifecycle hooks enable notification of an application or library whenever certain interesting conditions or actions occur for entities, properties, relationships, queries, context instances, and other EF constructs. We have implemented many lifecycle hooks over the previous versions of EF Core, including various interceptors and events. For EF7, we plan to add important missing hooks. For example, a hook for manipulation of entity instances after they are created, commonly known as ObjectMaterialized.
Table-per-concrete-type (TPC) mapping
Tracked by Issue #3170: TPC inheritance mapping pattern
Value proposition: Map entities in a hierarchy to separate tables without taking the performance hit of TPT mapping.
EF Core supports table-per-hierarchy (TPH) and table-per-type (TPT) mapping for .NET inheritance hierarchies. Table-per-concrete-type (TPC) mapping is similar to TPT mapping in that each entity type in the hierarchy is mapped to a different database table. However, while TPT maps properties from a base type to columns in a table for the base type, TPC maps properties of the base type to the same table as the actual concrete type being mapped. This can result in considerably faster performance since multiple tables do not need to be joined when querying for a specific type. This comes at the expense of data denormalization, since columns are duplicated across in the tables mapped to each concrete type in the hierarchy.
The work for TPC mapping also covers more general entity splitting, and support for specifying different facets per table in TPT, TPC or entity splitting.
Map CUD operations to stored procedures
Value proposition: Use stored procedures to manage data modifications.
EF Core already supports querying data from stored procedures. This feature will allow mapping the inserts, updates, and deletes generated by
SaveChanges to stored procedures in the database.
Value proposition: Applications can use DDD-style value objects in EF models.
It was previously the team view that owned entities, intended for aggregate support, would also be a reasonable approximation to value objects. Experience has shown this not to be the case. Therefore, in EF7, we plan to introduce a better experience focused on the needs of value objects in domain-driven design. This approach will be based on value converters rather than owned entities.
This work is initially scoped to allow value converters which map to multiple columns. We may pull in additional support based on feedback during the release.
Support value generation when using value converters
Value proposition: DDD-style encapsulated key types can make full use of automatically generated key values.
EF Core 6.0 allowed more types of value generation to be used with keys mapped through value converters. We plan to generalize and expand this support in EF7.
Raw SQL queries for unmapped types
Value proposition: Applications can execute more types of raw SQL query without dropping down to ADO.NET or using third-party libraries.
Currently raw SQL queries must return a type in the model, either with or without a key defined. In EF7, we plan to allow raw SQL queries that directly return types that are not contained in the EF model.
The work here will also cover raw SQL queries that return simple/scalar types, such as
Database scaffolding templates
Value proposition: The code generated by
dotnet ef database scaffold can be fully customized.
We frequently receive requests to adjust the code generated when scaffolding (reverse engineering) from an existing database. We plan to address these requests in EF7 by supporting T4 templates for the generated entity types and
DbContext. Developers will be able to customize the standard templates, or create new templates from scratch.
Theme: .NET platforms and ecosystem
Much of the work planned for EF7 involves improving the data access experience for .NET across different platforms and domains. This involves work in EF Core where needed, but also work in other areas to ensure a great experience across .NET technologies. We will focus on the following platforms/technologies for the EF7 release:
- .NET MAUI
- ASP.NET Core
- Azure Synapse
- Blazor Server
- Blazor WebAssembly
- Windows Forms
- Windows Presentation Foundation (WPF)
This list is based on many factors, including customer data, strategic direction, and available resources. The general areas we will be working on for these platforms are outlined below.
Value proposition: .NET Framework applications using distributed transactions can be ported to .NET 7.
System.Transactions library in .NET Framework contains native code that makes use of the Windows Distributed Transactions Coordinator (DTC) to support distributed transactions. This code was never ported to .NET Core. In the .NET 7 timeframe, we plan to investigate and begin the process of bringing this functionality to modern .NET. This will be initially for Windows only, and will support only database scenarios where the ADO.NET provider also supports distributed transactions. Other uses of distributed transactions, such as in WCF, will not be supported in .NET 7. Based on feedback and cost, we may implement support for other scenarios and/or non-Windows platforms in a future release.
EF Core tooling
Tracked by Issue #26798: Modernize EF Core tooling
dotnet ef commands are easy to use and work with modern platforms and technologies.
.NET platforms have evolved since we first introduced tooling for migrations, database scaffolding, etc. in EF Core 1.0. In EF7, we plan to update the tooling architecture to better support new platforms, like .NET MAUI, and to streamline the process in areas such as the use of multiple projects. This includes providing better feedback when things go wrong, better integration with logging, performance, and new sugar.
EF Core and graphical user interfaces
Value proposition: It is easy to build data-bound graphical applications with EF Core.
EF Core is designed to work well with data binding scenarios, such as those in Windows Forms and .NET MAUI. However, connecting the dots between these technologies is not always easy. For EF7, we plan to improve the experience with both work in EF Core and in Visual Studio to make it easier to build data-bound applications with EF Core.
Tracked in the .NET Data Lab repo
Value proposition: Fast, fully managed access to SQL Server and Azure SQL for modern .NET applications.
Microsoft.Data.SqlClient is a fully-featured ADO.NET database provider for SQL Server. It supports a broad range of SQL Server features on both .NET Core and .NET Framework. However, it is also a large and old codebase with many complex interactions between its behaviors. This makes it difficult to investigate the potential gains that could be made using newer .NET Core features.
We began a project last year, colloquially known as "Woodstar", to investigate the potential for a highly performing SQL Server driver for .NET. We plan to make significant further investment into this project in the EF7 timeframe.
Investment in Microsoft.Data.SqlClient is not changing. It will continue to be the recommended way to connect to SQL Server and Azure SQL, both with and without EF Core. It will continue to support new SQL Server features as they are introduced.
Azure Cosmos DB provider
Value proposition: Continue to make EF Core the easiest and most productive way to work with Azure Cosmos DB.
We made significant improvements to the EF Core Cosmos database provider for the 6.0 release. These improvements created a first-class experience for working with Azure Cosmos DB from EF Core, which is reflected by significant growth in adoption. We plan to continue this momentum in EF7 with the following further Cosmos provider enhancements:
- Issue #16146: Support aggregate operators
- Issue #17306: Allow to use a custom JSON serializer
- Issue #17670: Translate non-persisted property in query when possible
- Issue #19944: Support trigger execution
- Issue #20350: Detect partition key filters in more queries
- Issue #20910: Add translation for string.Compare for Cosmos
- Issue #23538: Improve query tree during translation
- Issue #24571: Allow terminating operators after Skip and Take
- Issue #24513: Add support for pagination (MaxItemCount)
- Issue #25700: translate Length/Count on collections
- Issue #25701: translate indexing into collection
- Issue #26478: Implement interceptors for Cosmos
- Issue #26491: Support AAD RBAC via the ClientSecretCredential
Please make sure to vote (👍) for the Cosmos provider features that you need so that we can assess where to invest for the most benefit.
Value proposition: It is easy to get started with migrations and later use them effectively in CI/CD pipelines.
EF Core 6.0 introduced migrations bundles, significantly improving the experience for cloud-native applications and database deployment within continuous integration and deployment systems. In EF7, we plan to make additional improvements in this area based on customer feedback. For example, we plan to support executing all migrations in a single transaction to facilitate easier recovery if something goes wrong.
In addition, we plan to improve the experience for developers getting started with migrations. This includes being able to create the database automatically when learning or beginning a project, and then easily switching to managed migrations as the project matures. Alternately, for projects with an existing database, we plan to make it easy to create an initial EF model and then switch to managing the database using migrations going forward.
As .NET continues to evolve we want to ensure that accessing data continues to be a great experience. To facilitate this, we plan to make progress on three areas during the EF7 timeframe.
Value proposition: Smaller applications that can be efficiently AOT compiled.
EF Core performs large amounts of runtime code generation. This is challenging for app models that depend on linker tree shaking, such as Xamarin and Blazor, and platforms that don't allow dynamic compilation, such as iOS. We plan to greatly improve trimming of unused code in EF7. This will facilitate smaller assembly sizes when using EF Core, thus helping deployment and making ahead-of-time (AOT) compilation more efficient.
Value proposition: Use modern C# language features in LINQ queries.
We are working with the Roslyn team on a plan to allow more C# features to be used in LINQ expressions. This is ongoing work which will mostly be tracked outside the EF Core repo.
Translate new LINQ operators
Tracked by Issue #25570: Support new .NET LINQ features
Value proposition: Use new LINQ operators when translating LINQ queries to SQL.
New LINQ operators have recently been added to the BCL, and we expect more to be added going forward. Issue #25570 tracks adding support for these to the EF7 LINQ provider. This issue will be updated as new LINQ operators are added. As with all existing LINQ operators, we will only add support when the operator has a reasonable and useful translation to the database.
Open telemetry for ADO.NET providers
Value proposition: Cross-platform, industry-standard telemetry that can be monitored in your tool of choice.
Open telemetry is an initiative of the Cloud Native Foundation to foster a common telemetry mechanism for cloud-native software. With regard to databases, this includes establishing a database client telemetry standard. We plan to do work in the EF7 timeframe to help bring open telemetry to ADO.NET providers in the .NET ecosystem. This includes work with the community on the open source MySQL and Npgsql providers, as well as Microsoft.Data.Sqlite. We will also reach out to other providers, and we encourage maintainers of ADO.NET providers to get in touch if interested.
Enhancements to System.Data
Value proposition: Better low-level data access to benefit all higher-level code.
As with every release, we intend to explore improvements to .NET's low-level database access API, System.Data. We will focus on performance improvements (e.g. reduce memory allocations by eliminating boxing when using the API), as well as some usability improvements.
The scope of the precise improvements will be determined later based on feasibility.
Research data access for cloud-native
Value proposition: Future evolution of .NET data access that supports modern approaches such as microservices and cloud native.
In the EF7 timeframe, we plan to research modern approaches to data access across .NET platforms, especially in reference to microservices and cloud-native applications. This research will help drive future investments in data access technologies for .NET.
Theme: Clear path forward from EF6
Value proposition: Easily move your application from EF6 to EF7.
EF Core has always supported many scenarios not covered by the legacy EF6 stack, as well as being generally much higher performing. However, EF6 has likewise supported scenarios not covered by EF Core. EF7 will add support for many of these scenarios, allowing more applications to port from legacy EF6 to EF7. At the same time, we are planning a comprehensive porting guide for applications moving from legacy EF6 to EF Core.
Much of the work in this theme overlaps with work already outlined above. Some of the more significant work items are:
- Issue #214: Expose model building conventions to applications
- Issue #245: Map inserts, updates, and deletes (CUD operations) to stored procedures
- Issue #620: Entity splitting support
- Issue #3170: TPC inheritance mapping pattern
- Issue #3864: Support unidirectional many-to-many relationships through shadow navigations
- Issue #4038: Code templates for scaffolding entity types and DbContext from an existing database
- Issue #10753: Support raw SQL queries without defining an entity type for the result
- Issue #11003: KeyAttribute support for composite primary key
- Issue #11624: Support raw SQL Queries for basic types like Guid, DateTime and int
- Issue #15911: Implement ObjectMaterialized event
- Issue #17653: Support for GroupBy entityType
- Issue #19929: Support GroupBy when it is final operator
- Issue #19930: Support GroupJoin when it is final query operator
- issue #26626: Use EF6 as an oracle for procedural testing of EF Core queries
In addition, we plan to make it clear on the legacy EF6 GitHub repo that we are not planning any future work on EF6. The exception to this is that we plan to add support for using EF6 with Microsoft.Data.SqlClient. This will be limited to runtime support. Use of the EF6 designer in Visual Studio will still require
Note that EF Core has a fundamentally different architecture to EF6. In particular, it does not make use of an Entity Data Model (EDM) specification. This means certain features such as EDMX and EntitySQL will never be supported in EF Core.
Great performance is a fundamental tenet of EF Core, lower-level data access, and indeed all of .NET. Every release includes significant work on improving performance. As always, this theme will involve a lot of iterative investigation, which will then inform where we focus resources.
Performance of database inserts and updates
Value proposition: High performance database inserts and updates from EF Core.
Over the past few releases, we have focused on improving EF Core performance on non-tracking queries. For EF7, we plan to focus on performance related to database inserts and updates. This includes performance of change-tracking queries, performance of
DetectChanges, and performance of the insert and update commands sent to the database.
Part of this work includes implementation of bulk (set-based) updates, which is tracked above as a highly-requested feature. However, we also plan to improve the performance of traditional updates using
TechEmpower composite score
Value proposition: High performing low-level data updates for all .NET applications.
We have been running the industry standard TechEmpower benchmarks on .NET against a PostgreSQL database for several years. In the last couple of releases, we have significantly improved the Fortunes benchmark for both low-level data access and EF Core.
In the EF7 timeframe we plan to specifically target improvements to the TechEmpower composite score. This measures performance over a wider range of scenarios.
Value proposition: Continuous improvement to EF Core to meet existing and evolving application requirements.
Miscellaneous features planned for EF 7.0 include, but are not limited to:
- Issue #14545: Design: Modernize generated C#
- Issue #15762: Provide easy way to get script from latest applied on database to latest in the codebase
- Issue #16406: Fully embrace provider-specific migrations
- Issue #18844: SQLite: Translate TimeSpan members
- Issue #18950: Enable nullability in migrations and model snapshots
- Issue #18990: Use the new batching API from ADO.NET
- Issue #21615: dotnet-ef database update -1 (down latest migration)
- Issue #21995: Generate the script for all migrations that have not yet been applied to a given database
- Issue #22138: Upgrade to SpatiaLite 5
- Issue #23085: Don't check for a connection string until after ConnectionOpening has been called
- Issue #24685: Allow value converters to change nullability of columns
- Issue #25103: SQLite: Translate more DateOnly and TimeOnly members
- Issue #25872: Provide more info about a migration bundle
- Issue #26155: Sugar for getting a migration script for just the last migration
- Issue #26417: Revisit the reporting of exceptions and stack traces in logging
- Issue #26528: Register a scoped DbContext automatically when using AddPooledDbContextFactory
Your feedback on planning is important. Please comment on GitHub Issue #26994 with any feedback or general suggestions about the plan. The best way to indicate the importance of an issue is to vote (👍) for that issue on GitHub. This data will then feed into the planning process for the next release.
Submit and view feedback for