Compare EF Core & EF6
Entity Framework is an object-relational mapper (O/RM) for .NET. This article compares the two versions: Entity Framework 6 and Entity Framework Core.
Entity Framework 6
Entity Framework 6 (EF6) is a tried and tested data access technology. It was first released in 2008, as part of .NET Framework 3.5 SP1 and Visual Studio 2008 SP1. Starting with the 4.1 release it has shipped as the EntityFramework NuGet package. EF6 runs on the .NET Framework 4.x and .NET Core from 3.0 onwards.
EF6 continues to be a supported product, and will continue to see bug fixes and minor improvements.
Entity Framework Core
Entity Framework Core (EF Core) is a complete rewrite of EF6 that was first released in 2016. It ships in Nuget packages, the main one being Microsoft.EntityFrameworkCore. EF Core is a cross-platform product that runs on .NET Core.
EF Core was designed to provide a developer experience similar to EF6. Most of the top-level APIs remain the same, so EF Core will feel familiar to developers who have used EF6.
EF Core offers new features that won't be implemented in EF6 (such as alternate keys, batch updates, and mixed client/database evaluation in LINQ queries. But because it's a new code base, it also lacks some features that EF6 has.
The following tables compare the features available in EF Core and EF6. It's a high-level comparison and doesn't list every feature or explain differences between the same feature in different EF versions.
The EF Core column indicates the product version in which the feature first appeared.
Creating a model
|Feature||EF 6||EF Core|
|Basic class mapping||Yes||1.0|
|Constructors with parameters||2.1|
|Property value conversions||2.1|
|Mapped types with no keys||2.1|
|Custom conventions||Yes||1.0 (partial)|
|Inheritance: Table per hierarchy (TPH)||Yes||1.0|
|Inheritance: Table per type (TPT)||Yes|
|Inheritance: Table per concrete class (TPC)||Yes|
|Shadow state properties||1.0|
|Many-to-many without join entity||Yes|
|Key generation: Database||Yes||1.0|
|Key generation: Client||1.0|
|Graphical visualization of model||Yes|
|Graphical model editor||Yes|
|Model format: Code||Yes||1.0|
|Model format: EDMX (XML)||Yes|
|Create model from database: Command line||Yes||1.0|
|Create model from database: VS wizard||Yes|
|Update model from database||Partial|
|Global query filters||2.0|
|Database scalar function mapping||Poor||2.0|
|Nullable reference types (C# 8.0)||3.0|
|LINQ queries||Yes||1.0 (in-progress for complex queries)|
|Readable generated SQL||Poor||1.0|
|Loading related data: Eager||Yes||1.0|
|Loading related data: Eager loading for derived types||2.1|
|Loading related data: Lazy||Yes||2.1|
|Loading related data: Explicit||Yes||1.1|
|Raw SQL queries: Entity types||Yes||1.0|
|Raw SQL queries: Keyless entity types||Yes||2.1|
|Raw SQL queries: Composing with LINQ||1.0|
|Explicitly compiled queries||Poor||2.0|
|Text-based query language (Entity SQL)||Yes|
|await foreach (C# 8.0)||3.0|
|Change tracking: Snapshot||Yes||1.0|
|Change tracking: Notification||Yes||1.0|
|Change tracking: Proxies||Yes|
|Accessing tracked state||Yes||1.0|
|Batching of statements||1.0|
|Stored procedure mapping||Yes|
|Disconnected graph low-level APIs||Poor||1.0|
|Disconnected graph End-to-end||1.0 (partial)|
|Database creation/deletion APIs||Yes||1.0|
|Lifecycle hooks (events, interception)||Yes|
|Simple Logging (Database.Log)||Yes|
|SQL Server Compact||Yes||1.0 (1)|
|Jet (Microsoft Access)||2.0 (1)|
|In-memory (for testing)||1.0|
1 The SQL Server Compact and Jet providers only work on .NET Framework (not on .NET Core).
|.NET Framework||Yes||1.0 (removed in 3.0)|
|.NET Core||Yes (added in 6.3)||1.0|
|Mono & Xamarin||1.0 (in-progress)|
Guidance for new applications
Consider using EF Core for a new application if both of the following conditions are true:
- The app needs the capabilities of .NET Core. For more information, see Choosing between .NET Core and .NET Framework for server apps.
- EF Core supports all of the features that the app requires. If a desired feature is missing, check the EF Core Roadmap to find out if there are plans to support it in the future.
Consider using EF6 if both of the following conditions are true:
- The app will run on Windows and the .NET Framework 4.0 or later.
- EF6 supports all of the features that the app requires.
Guidance for existing EF6 applications
Because of the fundamental changes in EF Core, we do not recommend moving an EF6 application to EF Core unless there is a compelling reason to make the change. If you want to move to EF Core to use new features, make sure you're aware of its limitations. For more information, see Porting from EF6 to EF Core. The move from EF6 to EF Core is more a port than an upgrade.
For more information, see the documentation: