Entity Framework Core 6: What Developers Want
Microsoft outlined its plan for Entity Framework Core 6, which in November will take its place as the data access component of the landmark .NET 6, a long-term support (LTS) release that will mark Microsoft's transition from the Windows-only .NET Framework to an open source, cross-platform umbrella offering of all things .NET.
EF Core 6 is .NET 6's improvement upon Entity Framework 6 (EF6), the company's tried-and-tested object-relational mapper (O/RM) with origins in the .NET Framework that provided early support for .NET Core, the precursor to .NET 5, .NET 6 and so on.
Tricky problems and the pandemic hampered Microsoft's development efforts for .NET 5, which arrived in November, and EF Core specifically, such as a troublesome LINQ implementation.
While detailing Microsoft's plans for EF Core 6, Jeremy Likness, senior program manager, .NET Data, .NET, focused on highly requested features, performance, migrations/deployment, feature improvements, bug fixes and more.
In the highly requested feature department, the team is relying upon GitHub issues to prioritize new functionality, of which Likness highlighted the following:
SQL Server temporal tables: "Allow temporal tables to be created via Migrations, as well as allowing access to historical data through LINQ queries." This comes from the community in issue #4693, submitted way back in March 2016.
It says: "Does EF Core support code first approach for Temporal tables? Looking to find a way to use Temporal tables with EF Core code first approach. Please guide me to the article if any existing already."
According to Microsoft documentation, temporal tables keep data closely related to time context so that stored facts can be interpreted as valid only within a specific period.
The temporal table issue is the top open issue on the GitHub list when measured by the number of thumbs-up icons 👍, and it ranked No. 3 on the list of most commented issues, with 112 at the time of this writing.
The most recent comment, from September 2019, reads: "Really long wait for this. I hope this will be prioritized since it is now at the top based on label
consider-for-next-release and sort on reaction 👍"
JSON columns: "Introduce common patterns for JSON support that can be implemented by any database provider. JSON column support will be implemented for SQL Server and SQLite. (Note that the PostgreSQL and MySQL providers already support JSON columns.)"
This comes from issue #4021, submitted December 2015 and titled "Map JSON values stored in database to EF properties." The problem, it says, is: "Currently, JSON fields can be mapped to entities in entity framework as string properties and we can parse them using Json.Net library. It would be good if we could map properties in EF model to (JSON text+path)." It garnered 77 comments as of this writing and was No. 2 on the list of thumbs-up reactions.
ColumnAttribute.Order: "Allow arbitrary ordering of columns when creating a table with Migrations or
EnsureCreated." This comes from issue #10059, submitted October 2017 and titled "Support ColumnAttribute.Order."
The issue states:
"#2272 matched the CLR reflection order for columns within a table.
During design, we decided to wait for more feedback before honoring the value of
ColumnAttibute.Order on the properties.
If the implementation of #2272 is insufficient for you and specifying something like
[Column(Order = 1)] would help, please vote for this issue and add details about your scenario (if not already listed) below."
This issue is No. 7 when ranked by thumbs-up reactions and resulted in 23 comments, with one from September 2020 reading: "Implementing this would also help in adding composite key using data annotations. if ef6 we could use column to denote the order of composite key. Since this is not implemented in ef core we get error 'entity type has composite type defined with data annotations, use fluent api' in ef core. So implement this or add parameter to key to denote order of composite key."
As stated, Likness also detailed plans for performance, migrations, deployments and more.
On the performance front, Likness said EF Core 6 already outperforms EF6 and several initiatives were planned to make it even faster, including:
- Performance infrastructure and new tests: "Improve the infrastructure for performance tests as well as adding new tests and fixing low-hanging fruit."
- Compiled models: "Compiled models will improve startup performance, as well as having generally better performance when accessing the model."
- TechEmpower Fortunes: "We plan to match Dapper performance on the TechEmpower Fortunes benchmark. (This is a significant challenge which will likely not be fully achieved. Nevertheless, we will get as close as we can.)"
- Linker/AOT: "We will continue investigating in making EF Core work better with linkers and AOT. We do not expect to fully close the gap in the 6.0 timeframe, but we hope to make significant progress."
While all of the above and more is planned for EF Core 6 -- including many bug fixes and integration with other .NET data technologies like
Microsoft.Data.Sqlite -- Microsoft is also planning some experiments and investigations.
"This is a learning process and as such no concrete deliverables are planned for the 6.0 release," said Likness, who pointed to:
- SqlServer.Core: "An experiment in collaboration with the community to determine what potential there is modern .NET features in a highly performant SQL Server driver."
- GraphQL: "We plan to investigate the space and collaborate with the community to find ways to improve the experience of using GraphQL with .NET."
More information on all of the above and many more plans are included in Microsoft's Release planning process documentation and the Plan for Entity Framework Core 6.0.
About the Author
David Ramel is an editor and writer for Converge360.