Today, the Entity Framework Core team announces the sixth preview release of EF Core 6.0. The team continues work on the features you helped prioritize. In addition to adding new capabilities, we are closing the gap between EF Core and EF6. Issue #24106 shares details about the differences and our roadmap to eliminate it. We are making progress on features like migrations bundles and implicit ownership in the Azure Cosmos DB provider but are not quite ready for you to test them yet. However, many updates are available right now when you download preview 6 (see the end of this blog post for details on how).
💡 Starting with preview 6, EF Core 6 targets the .NET 6 Target Framework Moniker (TFM).
A few highlights for this release include:
- Support for 64-bit identity seed values
- Support for new BCL
DateOnly
andTimeOnly
structs for SQLite - Uniquify and validate check constraint names
- Pre-convention model configuration
- The items on this list
This release supports pre-convention model configuration. Doing an initial discovery of the model based only on DbSet
roots was a reasonable approach when it was easy to distinguish likely scalar properties from likely navigation properties. However, as we allow more and more types to be mapped, it has become increasingly problematic to…
- Exclude a type as an entity type and therefore avoid trying to bring it and all its properties into the model
- Revert a type from being an entity type when a value converter is found or the type is ignored
This results in both bugs and additional overhead. This release, we focused on finding ways to enhance model building so that it can more efficiently figure out what is an entity type and what is not. For example, assume you always store string data as byte arrays. Instead of configuring every single entity, you can use the ConfigureConventions
override. It looks like this:
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
configurationBuilder.Properties<string>()
.HaveConversion<byte[]>()
.HaveMaxLength(255);
configurationBuilder.IgnoreAny<INonPersisted>();
}
We want to hear from you! If you and/or your team are using the Entity Framework Designer (the visual editor for EDMX files in Visual Studio) we’d like to understand how you use the designer and what might be stopping you from migrating to the latest code base. Give us feedback by commenting on issue #25248.
How to get EF Core 6.0 previews
EF Core is distributed exclusively as a set of NuGet packages. For example, to add the SQL Server provider to your project, you can use the following command using the dotnet tool:
dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 6.0.0-preview.6.21352.1
This following table links to the preview 6 versions of the EF Core 6.0 packages and describes what they are used for.
Package | Purpose |
---|---|
Microsoft.EntityFrameworkCore | The main EF Core package that is independent of specific database providers |
Microsoft.EntityFrameworkCore.SqlServer | Database provider for Microsoft SQL Server and SQL Azure |
Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite | SQL Server support for spatial types |
Microsoft.EntityFrameworkCore.Sqlite | Database provider for SQLite that includes the native binary for the database engine |
Microsoft.EntityFrameworkCore.Sqlite.Core | Database provider for SQLite without a packaged native binary |
Microsoft.EntityFrameworkCore.Sqlite.NetTopologySuite | SQLite support for spatial types |
Microsoft.EntityFrameworkCore.Cosmos | Database provider for Azure Cosmos DB |
Microsoft.EntityFrameworkCore.InMemory | The in-memory database provider |
Microsoft.EntityFrameworkCore.Tools | EF Core PowerShell commands for the Visual Studio Package Manager Console; use this to integrate tools like scaffolding and migrations with Visual Studio |
Microsoft.EntityFrameworkCore.Design | Shared design-time components for EF Core tools |
Microsoft.EntityFrameworkCore.Proxies | Lazy-loading and change-tracking proxies |
Microsoft.EntityFrameworkCore.Abstractions | Decoupled EF Core abstractions; use this for features like extended data annotations defined by EF Core |
Microsoft.EntityFrameworkCore.Relational | Shared EF Core components for relational database providers |
Microsoft.EntityFrameworkCore.Analyzers | C# analyzers for EF Core |
We also published the 6.0 preview 6 release of the Microsoft.Data.Sqlite.Core provider for ADO.NET.
Thank you from the team
A big thank you from the EF team to everyone who has used EF over the years!
Arthur Vickers | Andriy Svyryd | Brice Lambson | Jeremy Likness |
Maurycy Markowski | Shay Rojansky | Smit Patel |
Thank you to our contributors!
We are grateful to our amazing community of contributors. Our success is founded upon the shoulders of your efforts and feedback. If you are interested in contributing but not sure how or would like help, please reach out to us! We want to help you succeed. We would like to publicly acknowledge and thank these contributors for investing in the success of EF Core 6.0.
When there will support of DateOnly and TimeOnly for SQL Server?
Upvote dotnet/SqlClient#1009 to let ’em know it’s important to you.
What’s 64 bit identity seed? long int?
@Rosdi Kasim
That’s what it looks like. See here – Github Issue Pertaining To 64 Bit Identity Seeds
Ah ok.