What’s New in EF Core 6.0 Preview 1
The Entity Framework Core 6 dev team shipped Preview 1 this week, headed toward a debut with the larger, unifying .NET 6 umbrella platform in November.
EF Core is a modern object-database mapper for .NET, supporting LINQ queries, change tracking, updates and schema migrations. It works with SQL Server, Azure SQL Database, SQLite, Azure Cosmos DB, MySQL, PostgreSQL and other databases, Microsoft says, through a provider plugin API. It’s the cross-platform, open source successor to Entity Framework that was included in the old, Windows-only .NET Framework that has evolved into .NET 5/6.
Its November debut will come one year after Microsoft shipped EF Core 5 as part of .NET 5, and it will be a long-term support (LTS) release, good to go for three years.
The first preview of EF Core 6 doesn’t include much in the way of new functionality, basically featuring a bunch of minor tweaks to incrementally improve the developer experience. The finished product, however, will include many highly requested features from developers, as reported in the article “Entity Framework Core 6: What Developers Want.”
Microsoft also lays out the landscape in its Plan for Entity Framework Core 6.0, which further details those highly requested features (links take you to associated GitHub issues, and descriptions are from Microsoft):
- SQL Server temporal tables — Temporal tables support queries for data stored in the table at any point in time, as opposed to only the most recent data stored as is the case for normal tables. EF Core 6.0 will allow temporal tables to be created via Migrations, as well as allowing access to the data through LINQ queries.
- JSON 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.
- ColumnAttribute.Order — This feature will allow arbitrary ordering of columns when creating a table with Migrations or
EnsureCreated. Note that changing the order of columns in an existing tables requires that the table be rebuilt, and this is not something that we plan to support in any EF Core release.
Meanwhile, on the performance front, the plan lists these items:
- Performance infrastructure and new tests (no link) — The EF Core codebase already contains a set of performance benchmarks that are executed every day. For 6.0, we plan to improve the infrastructure for these tests as well as adding new tests. We will also profile mainline perf scenarios and fix any low-hanging fruit found.
- Compiled models — Compiled models will allow the generation of a compiled form of the EF model. This will provide both better startup performance, as well as generally better performance when accessing the model.
- TechEmpower Fortunes — We have been running the industry standard TechEmpower benchmarks on .NET against a PostgreSQL database for several years. The Fortunes benchmark is particularly relevant to EF scenarios. We have multiple variations of this benchmark
- Linker/AOT — 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 will continue investigating in this space as part of EF Core 6.0 and make targeted improvements as we can. However, we do not expect to fully close the gap in the 6.0 time frame.
As far as what’s new in Preview 1, Microsoft’s “What’s New in EF Core 6.0” documentation lists a dozen or so item ranging from several new attributes (UnicodeAttribute, PrecisionAttribute, EntityTypeConfigurationAttribute) to “Support for SQL Server sparse columns” to “Database comments are scaffolded to code comments.”