Compare EF6 and EF Core
Edit
Twitter
LinkedIn
Facebook
Email
-
Article -
- 4 minutes to read
-
EF Core
Entity Framework Core (EF Core) is a modern object-database mapper for . NET. It supports LINQ queries, change tracking, updates, and schema migrations.
EF Core works with SQL Server/Azure SQL Database, SQLite, Azure Cosmos DB, MySQL, PostgreSQL, and many more databases through a database provider plugin model.
EF6
Entity Framework 6 (EF6) is an object-relational mapper designed for .NET Framework but with support for .NET Core. EF6 is a stable, supported product, but is no longer being actively developed.
Feature comparison
EF Core offers new features that won’t be implemented in EF6. However, not all EF6 features are currently implemented in EF Core.
The following tables compare the features available in EF Core and EF6. This is 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 | EF6. 4 | 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 | |
Conventions | Yes | 1.0 |
Custom conventions | Yes | 7.0 |
Data annotations | Yes | 1.0 |
Fluent API | Yes | 1.0 |
Inheritance: Table per hierarchy (TPH) | Yes | 1.0 |
Inheritance: Table per type (TPT) | Yes | 5.0 |
Inheritance: Table per concrete class (TPC) | Yes | 7.0 |
Shadow state properties | 1.0 | |
Alternate keys | 1.0 | |
Many-to-many navigations | Yes | 5.0 |
Many-to-many without join entity | Yes | 5. 0 |
Key generation: Database | Yes | 1.0 |
Key generation: Client | 1.0 | |
Complex/owned types | Yes | 2.0 |
Spatial data | Yes | 2.2 |
Model format: Code | Yes | 1.0 |
Create model from database: Command line | Yes | 1.0 |
Update model from database | Partial | On the backlog (#831) |
Global query filters | 2.0 | |
Table splitting | Yes | 2.0 |
Entity splitting | Yes | 7.0 |
Database scalar function mapping | Poor | 2.0 |
Database table valued function mapping | Poor | 5.0 |
Field mapping | 1.1 | |
Nullable reference types (C# 8.0) | 3.0 | |
Graphical visualization of model | Yes | No support planned (1) |
Graphical model editor | Yes | No support planned (1) |
Model format: EDMX (XML) | Yes | No support planned (1) |
Create model from database: VS wizard | Yes | No support planned (1) |
Querying data
Feature | EF6. 4 | EF Core |
---|---|---|
LINQ queries | Yes | 1.0 |
Readable generated SQL | Poor | 1.0 |
GroupBy translation | Yes | 2.1 |
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 |
await foreach (C# 8.0) | 3.0 | |
Text-based query language (Entity SQL) | Yes | No support planned (1) |
Saving data
Feature | EF6. 4 | EF Core |
---|---|---|
Change tracking: Snapshot | Yes | 1.0 |
Change tracking: Notification | Yes | 1.0 |
Change tracking: Proxies | Yes | 5.0 |
Accessing tracked state | Yes | 1.0 |
Optimistic concurrency | Yes | 1.0 |
Transactions | Yes | 1.0 |
Batching of statements | 1.0 | |
Stored procedure mapping | Yes | 7.0 |
Disconnected graph low-level APIs | Poor | 1.0 |
Disconnected graph End-to-end | 1.0 (partial; #5536) |
Other features
Feature | EF6.4 | EF Core |
---|---|---|
Migrations | Yes | 1.0 |
Database creation/deletion APIs | Yes | 1. 0 |
Seed data | Yes | 2.1 |
Connection resiliency | Yes | 1.1 |
Interceptors | Yes | 3.0 |
Events | Yes | 3.0 (partial; #626) |
Simple Logging (Database.Log) | Yes | 5.0 |
DbContext pooling | 2.0 |
Database providers
(2)
Feature | EF6.4 | EF Core |
---|---|---|
SQL Server | Yes | 1.0 |
MySQL | Yes | 1.0 |
PostgreSQL | Yes | 1.0 |
Oracle | Yes | 1.0 |
SQLite | Yes | 1.0 |
SQL Server Compact | Yes | 1.0 (3) |
DB2 | Yes | 1.0 |
Firebird | Yes | 2. 0 |
Jet (Microsoft Access) | 2.0 (3) | |
Azure Cosmos DB | 3.0 | |
In-memory (for testing) | 1.0 |
1 Some EF6 features will not be implemented in EF Core. These features either depend on EF6’s underlying Entity Data Model (EDM) and/or are complex features with relatively low return on investment. We always welcome feedback, but while EF Core enables many things not possible in EF6, it is conversely not feasible for EF Core to support all the features of EF6.
2 EF Core database providers implemented by third-parties may be delayed in updating to new major versions of EF Core. See Database Providers for more information.
3 The SQL Server Compact and Jet providers only work on .NET Framework (not on .NET Core).
Supported platforms
EF Core 3.1 runs on .NET Core and .NET Framework, through the use of .NET Standard 2. 0. However, EF Core 5.0 does not run on .NET Framework. See Platforms for more details.
EF6.4 runs on .NET Core and .NET Framework, through multi-targeting.
Guidance for new applications
Use EF Core on .NET Core for all new applications unless the app needs something that is only supported on .NET Framework.
Guidance for existing EF6 applications
EF Core is not a drop-in replacement for EF6. Moving from EF6 to EF Core will likely require changes to your application.
When moving an EF6 app to .NET Core:
- Keep using EF6 if the data access code is stable and not likely to evolve or need new features.
- Port to EF Core if the data access code is evolving or if the app needs new features only available in EF Core.
- Porting to EF Core is also often done for performance. However, not all scenarios are faster, so do some profiling first.
See Porting from EF6 to EF Core for more information.
Feedback
Submit and view feedback for
This product
This page
View all page feedback
Compare WW Memberships and Plans
Two membership options, one goal
Lose weight and keep it off—just choose your level of support.
Great if you want: a self-guided experience
Get it with: our award winning app—the foundation of lasting weight loss
- A customized, science-backed nutrition plan guides you to lose the weight you want while keeping the foods you love.
- Get in-app support when you want it with 24/7 coach chat and our members-only social network.
- Unlock food and activity trackers, 12,000 recipes, on-demand workouts, and better-sleep tools to help you build and maintain healthy habits.
- Visualize your achievements in your weekly progress report and set goals for the week ahead.
Loading…
Workshops are open!
Premium
Great if you want: the most support
Get it with: in-person or virtual Workshops with your WW coach and other members for face-to-face accountability and ultimate convenience
- Includes Core and our scientifically proven weight-loss program!
- Choose from thousands of in-person and virtual Workshops available from morning to night, 7 days a week. Attend as many as you’d like!
- Learn brand-new nutrition and behavioral techniques from your coach and bond with others on a similar journey.
- Dedicate time to share your goals, progress, tips, and advice with your group in a totally judgment-free zone.
Loading…
Great if you want: a self-guided experience
Get it with: our award winning app—the foundation of lasting weight loss
- A customized, science-backed nutrition plan guides you to lose the weight you want while keeping the foods you love.
- Get in-app support when you want it with 24/7 coach chat and our members-only social network.
- Unlock food and activity trackers, 12,000 recipes, on-demand workouts, and better-sleep tools to help you build and maintain healthy habits.
- Visualize your achievements in your weekly progress report and set goals for the week ahead.
Loading…
Workshops are open!
Premium
Great if you want: the most support
Get it with: in-person or virtual Workshops with your WW coach and other members for face-to-face accountability and ultimate convenience
- Includes Core and our scientifically proven weight-loss program!
- Choose from thousands of in-person and virtual Workshops available from morning to night, 7 days a week. Attend as many as you’d like!
- Learn brand-new nutrition and behavioral techniques from your coach and bond with others on a similar journey.
- Dedicate time to share your goals, progress, tips, and advice with your group in a totally judgment-free zone.
Loading…
Comparing Kernel and User Mode Runtimes
You can use the Performance Monitor to see how long your system is running in kernel mode compared to running in user mode.
Do the following:
- Start Performance Monitor by opening the Start menu and selecting Control Panel — Administrative Tools — Performance Monitor (AllPrograms — AdministrativeTools — Performance Monitor). In the tree-like drop-down list of Performance tools on the left, select Monitoring Tools — Performance Monitor. nine0008
- Click the add (+) button on the toolbar.
- Expand the Processor counter section, click on the % Privileged Time counter item and, while holding down the Ctrl key, click on the % User Time item.
- Click the «Add» button and then the OK button.
- Open a command prompt window and directly scan your C drive over the network by typing dir\\%computername%\c$/s. nine0008
6. When finished, close the tool window. The same picture can be quickly viewed using the Task Manager. Click the Performance tab, and then select Show Kernel Times from the View menu. On the CPU utilization graph, the green color will show its total utilization, and the red color will show the utilization in kernel mode.
To see how much kernel and user mode time Performance Monitor itself is using, run it again, but add the separate % User Time and % Privileged process counters. mode (% Privileged Time) for each process in the system:
- If Performance Monitor is not running, start it again. (If it is already running, start from a blank display by right-clicking in the graph area and selecting Remove All Counters.)
- Click the add (+) button on the toolbar.
- In the available area of the counters, expand the Process section.
- Select the % User Time and % Privileged Time counters. nine0008
- Select multiple processes in the Instances area (for example, mmc, csrss, and Idle).
- Click the Add button and then the OK button.
- Move the mouse vigorously in different directions.
- Select «Highlight» from the toolbar or press Ctrl+H to turn on the highlight mode. The currently selected counter will be highlighted in black.
- Scroll down the list of counters to determine the processes whose threads were started when the mouse moved, and note whether they were started in user or kernel mode. nine0008
You should see (by looking for the mmc process in the Instance column) that the runtime graph of the System Monitor process in kernel mode and in user mode has gone up when you move the mouse, because it is executing application code in user mode, and Windows functions that run in kernel mode are called. Also note the activity of the thread owned by the csrss process running in kernel mode as the mouse moves.
This activity occurs because this process owns the original input stream of the kernel-mode Windows subsystem that handles keyboard and mouse input. Finally, the Idle process, which, as you can see, spends almost 100% of its time running in kernel mode, is not really a process, it is a spoof process used to count idle CPU cycles.
Based on the mode in which the threads of the Idle process are started when Windows has nothing to do, the wait process occurs in kernel mode. nine0003
Comparison of WSL versions | Microsoft Learn
- Article
- Reading takes 6 minutes
Learn more about the different versions of WSL, including why WSL 2 is now the default, and specific scenarios or exceptions that may require your Linux distribution to switch to an earlier WSL 1 architecture.
WSL 1 and WSL 2 comparison
This guide compares WSL 1 and WSL 2, including exceptions for using WSL 1 rather than WSL 2. The main differences between WSL 1 and WSL 2 are the use of an actual Linux kernel inside a managed virtual machine , support full system call compatibility and performance in Linux and Windows operating systems. WSL 2 is the current default version when installing a Linux distribution and uses the latest and greatest virtualization technologies to run the Linux kernel in a lightweight utility virtual machine. If your distribution is currently running WSL 1 and you want to upgrade to WSL 2, see Upgrading from WSL 1 to WSL 2.
Feature comparison
Feature | WSL1 | WSL2 |
---|---|---|
Windows and Linux integration | ✅ | ✅ |
Quick start | ✅ | ✅ |
Small footprint compared to traditional VMs | ✅ | ✅ |
Running with current versions of VMware and VirtualBox | ✅ | ✅ |
Managed virtual machine | ❌ | ✅ |
Full Linux Kernel | ❌ | ✅ |
Full system call compatibility | ❌ | ✅ |
Performance in OS file systems | ✅ | ❌ |
As can be seen from the comparison table above, the WSL 2 architecture outperforms WSL 1 in several ways, with the exception of performance on operating system file systems, which can be accessed by storing project files on the same operating system as the running in project funds. nine0003
The WSL 2 subsystem is only available on Windows 11 or Windows 10 version 1903 build 18362 or later. Check your Windows version by pressing Windows + R , enter winver , select OK . (Or enter the command ver
at the Windows command prompt). You may need to upgrade to the latest version of Windows. For builds below 18362, WSL is not supported.
Note
WSL 2 works with VMware 15.5.5 and later and VirtualBox 6 and later. For more information, see FAQ. nine0003
New features in WSL 2
WSL 2 is a major upgrade of the core architecture that uses virtualization technology and the Linux kernel to implement new features. The main priorities of this update are to increase file system performance and add full system call compatibility.
- WSL 2 system requirements
- Upgrading a Linux distribution version from WSL 1 to WSL 2
- WSL 2 FAQ
WSL 2 architecture
During normal operation, the virtual machine may slow down on startup, become isolated, consume a lot of resources, and take time to manage. The WSL 2 subsystem does not have these issues.
WSL 2 provides the benefits of WSL 1, including easy integration between Windows and Linux, fast boot, low resource consumption, and no virtual machine setup or management required. Although WSL 2 uses a virtual machine, it will be managed and run in the background, providing the same user experience as WSL 1.
Fully functional Linux kernel
The Linux kernel in WSL 2 is built in-house by Microsoft from the latest stable source branch available at kernel.org. This kernel is specially tuned for WSL 2 by optimizing size and performance to provide an incredible Linux experience on Windows. The kernel will be serviced by Windows updates. This means you get the latest security fixes and kernel improvements without having to deal with it yourself. nine0003
The WSL 2 Linux kernel is an open source project. If you’d like to learn more, check out the blog post Implementing the Linux Kernel on Windows by the team that built the kernel.
For more information, see the Windows Subsystem for Linux kernel release notes.
Improved file I/O performance
Commands for file-intensive operations such as git clone, npm install, apt update, apt upgrade, and others are noticeably faster with WSL 2. nine0003
The actual speed increase will depend on which application you are using and how it interacts with the file system. Initial versions of WSL 2 run 20 times faster than WSL 1 when decompressing a compressed tarball, and 2 to 5 times faster when using git clone, npm install, and cmake across projects.
Full system call compatibility
Linux binaries use system calls to perform functions such as accessing files, requesting memory, creating processes, and more. While WSL 1 uses a translation layer created by the WSL team, WSL 2 has its own Linux kernel with full system call compatibility. Benefits available:
-
a range of new applications that can be run inside WSL, such as Docker and others;
-
All Linux kernel updates are immediately ready for use. (You don’t have to wait for WSL to implement updates and add changes.)
Exceptions for using WSL 1 instead of WSL 2
WSL 2 is recommended because it provides better performance and full system call compatibility. However, there are a few specific scenarios where WSL 1 might be preferable. We recommend using WSL 1 if:
- Project files must be stored in the Windows file system. WSL 1 provides faster access to files connected from Windows.
- If you use the WSL Linux distribution to access project files on the Windows file system, and those files cannot be stored on the Linux file system, you will get better performance on OS file systems using WSL 1.
- A project that requires cross-compilation using Windows and Linux tools on the same files.
nine0170 - File operations on Windows and Linux operating systems are faster in WSL 1 than in WSL 2. Therefore, if you use Windows applications to access Linux files, you will currently experience better performance with WSL 1.
- WSL 2 memory usage scales with usage. When a process frees memory, it is automatically made available to Windows. But right now, WSL 2 does not release cached pages in memory, making them available to Windows until the WSL instance terminates. If you have long WSL sessions or access a very large amount of files, this cache can consume memory in Windows. We’re monitoring the progress of changes as we optimize them in the WSL repository (issue 4166) on Github. nine0008
Note
Try using the VS Code WSL Remote Extension to store project files on a Linux file system using the Linux command line tools.