Announcing Entity Framework Core 6.0 Preview 6: Configure Conventions

Jeremy Likness

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 and TimeOnly 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!

ajcvickers Arthur Vickers AndriySvyryd Andriy Svyryd Brice Lambson JeremyLikness Jeremy Likness
maumar Maurycy Markowski roji Shay Rojansky smitpatel 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.

AkinSabriCam alexernest alexpotter10 Ali-YousefiTelori
#1 #1 #1 #1, #2
AlirezaRezaeeIR andrejs86 AndrewKitu ardalis
#1 #1 #1 #1
bartoszluka CaringDev carlreid carlreinke
#1 #1, #2 #1, #2 #1, #2
cgrevil cgrimes01 cincuranet cuperman007
#1 #1 #1, #2, #3, #4 #1
dan-giddins dannyjacosta dennisseders DickBaker
#1 #1, #2 #1, #2, #3, #4, #5, #6 #1
ErikEJ fagnercarvalho FarshanAhamed filipnavara
#1, #2, #3, #4, #5, #6, #7, #8, #9, #10, #11, #12, #13, #14, #15, #16 #1, #2 #1 #1, #2
garyng Geoff1900 gfoidl gieseanw
#1, #2, #3 #1 #1, #2 #1
Giorgi GitHubPang gurustron hez2010
#1, #2, #3, #4 #1, #2 #1 #1, #2
HSchwichtenberg jaliyaudagedara jantlee jeremycook
#1, #2 #1, #2 #1 #1
jing8956 joakimriedel joaopgrassi joelmandell
#1 #1, #2, #3 #1, #2 #1
JohnMHigginsPMC JonasSamuelsson josemiltonsampaio KaloyanIT
#1 #1 #1 #1, #2, #3, #4
khalidabuhakmeh khellang koenbeuk kotpal
#1, #2 #1 #1, #2 #1
larsholm lauxjpn leonardoporro lexkazakov
#1, #2 #1, #2, #3, #4, #5, #6 #1 #1
mariuz marodev martincostello MartinWestminster
#1 #1, #2 #1, #2, #3, #4 #1
Marusyk massytech MattKomorcec MaxG117
#1, #2, #3, #4, #5, #6, #7, #8, #9, #10, #11, #12, #13, #14, #15, #16, #17, #18 #1 #1, #2 #1
mefateah meggima mguinness michalczerwinski
#1 #1, #2 #1 #1, #2, #3, #4, #5, #6
mrlife msawczyn MSDN-WhiteKnight natashanikolic
#1, #2, #3, #4 #1 #1 #1
nmichels nschonni ntovas OKTAYKIR
#1, #2 #1, #2, #3, #4 #1, #2 #1
OOberoi Oxyrus pkellner ptupitsyn
#1, #2 #1 #1 #1
ralmsdeveloper RaymondHuy riscie seekingtheoptimal
#1, #2 #1, #2, #3, #4, #5, #6, #7, #8 #1, #2 #1
SergerGood Shirasho SimonCropp smagurauskas
#1, #2, #3, #4, #5, #6, #7, #8, #9, #10 #1 #1, #2 #1, #2
stevendarby Strepto taha-ghadirian teo-tsirpanis
#1, #2 #1, #2 #1, #2 #1, #2
the-wazz thiggins1990 tkp1n umitkavala
#1, #2 #1 #1, #2 #1, #2, #3, #4, #5, #6
uncheckederror Varorbc vincent1405 vonzshik
#1 #1 #1, #2 #1, #2, #3, #4, #5, #6
vytotas wdesgardin wmeints yesmey
#1 #1, #2 #1, #2 #1, #2, #3, #4, #5, #6

5 comments

Discussion is closed. Login to edit/delete existing comments.

  • Rosdi Kasim 0

    What’s 64 bit identity seed? long int?

      • Rosdi Kasim 0

        Ah ok.

  • Eugene Ivanoff 0

    When there will support of DateOnly and TimeOnly for SQL Server?

    • Brice Lambson 0

      Upvote dotnet/SqlClient#1009 to let ’em know it’s important to you.

Feedback usabilla icon