Microsoft.EntityFrameworkCore 9.0.0

Entity Framework Core (EF Core) is a modern object-database mapper that lets you build a clean, portable, and high-level data access layer with .NET (C#) across a variety of databases, including SQL Server (on-premises and Azure), SQLite, MySQL, PostgreSQL, Oracle, and Azure Cosmos DB. It supports LINQ queries, change tracking, updates, and schema migrations.

Getting started

Prerequisites

Make sure to install the same version of all EF Core packages shipped by Microsoft. For example, if version 5.0.3 of Microsoft.EntityFrameworkCore.SqlServer is installed, then all other Microsoft.EntityFrameworkCore.* packages must also be at 5.0.3.

Usage

To use Microsoft.EntityFrameworkCore in your application, you will typically need to create a class that inherits from DbContext, which represents your database session. You can then define classes that represent your database entities, and use LINQ queries to interact with the database.

Here's an example of how you might define a database context and an entity:

using Microsoft.EntityFrameworkCore;

public class MyDbContext : DbContext
{
    public DbSet<Customer> Customers { get; set; }
}

public class Customer
{
    public int Id { get; set; }
    public string Name { get; set; }
}

You can then use the MyDbContext class to interact with the database:

using var context = new MyDbContext();

// Add a new customer
context.Customers.Add(new Customer { Name = "John Doe" });
context.SaveChanges();

// Retrieve all customers
var customers = context.Customers.ToList();

Microsoft.EntityFrameworkCore supports multiple database providers, including SQL Server, MySQL, PostgreSQL, SQLite, and others. You will need to install the provider package for your chosen database. For example, to use SQL Server, you would install the Microsoft.EntityFrameworkCore.SqlServer package.

You would then configure your database context to use the SQL Server provider:

using Microsoft.EntityFrameworkCore;

public class MyDbContext : DbContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder options)
        => options.UseSqlServer(@"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=MyDatabase");

    public DbSet<Customer> Customers { get; set; }
}

public class Customer
{
    public int Id { get; set; }
    public string Name { get; set; }
}

Additional documentation

Feedback

If you have a specific question about using these projects, we encourage you to ask it on Stack Overflow. If you encounter a bug or would like to request a feature, submit an Github issue. For more details, see getting support.

Showing the top 20 packages that depend on Microsoft.EntityFrameworkCore.

Packages Downloads
Devart.Data.Oracle.EFCore
dotConnect for Oracle is an enhanced database connectivity solution built over ADO.NET architecture and a development framework with advanced support for ORMs, such as Entity Framework and EF Core, and offers a complete solution for developing DB-related applications and web sites. It introduces new approaches for designing a data access layer and boosts the productivity of database application development. This package contains the .NET Standard/.NET Core compatible assemblies with Entity Framework Core-related functionality of dotConnect for Oracle. It includes support for Entity Framework Core 1.1 - 3.0. Note that for Entity Framework Core 1.1 it does not include support for database-first approach via the Scaffold-DbContext command, which is available via the separate Devart.Data.Oracle.EFCore.Design package. This package contains only runtime features of dotConnect for Oracle. dotConnect for Oracle is also provided as an installation package (exe), which installs runtime assemblies for Full .NET Framework and a set of design-time tools, integrated into Visual Studio - Server Explorer integration, DataSet tools, Windows Forms components with powerful design-time, etc. It also includes visual ORM designer for Entity Framework, Entity Framework Core, and LinqConnect ORM models. Besides, this installer generates the trial key files required for using this package on a trial basis. You can download it at www.devart.com.
10
DotNetCore.CAP.MySql
Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern.
21
DotNetCore.CAP.SqlServer
Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern.
5
DotNetCore.CAP.SqlServer
Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern.
16
EFCore.BulkExtensions
EntityFramework EF Core Bulk Batch Extensions for Insert Update Delete and Read (CRUD) operations on SQL Server and SQLite
12
EFCore.BulkExtensions
EntityFramework EF Core Bulk Batch Extensions for Insert Update Delete and Read (CRUD) operations on SQL Server.
5
Microsoft.AspNetCore.App
Provides a default set of APIs for building an ASP.NET Core application. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.
6
Microsoft.EntityFrameworkCore.InMemory
In-memory database provider for Entity Framework Core (to be used for testing purposes). This package was built from the source code at https://github.com/aspnet/EntityFrameworkCore/tree/ee3828a168f874efc5e5c8cc8c9bce9aa7db9d25
6
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
4
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
6
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
17
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
20
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
21
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
23
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
24
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers. This package was built from the source code at https://github.com/aspnet/EntityFrameworkCore/tree/01da710cdeff0431fc60379580aa63f335fbc165
6
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers. This package was built from the source code at https://github.com/aspnet/EntityFrameworkCore/tree/ee3828a168f874efc5e5c8cc8c9bce9aa7db9d25
5
MySql.EntityFrameworkCore
MySql.EntityFrameworkCore for Entity Framework.
30
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
30

Version Downloads Last updated
11.0.0-preview.2.26159.112 0 2026/3/10
11.0.0-preview.1.26104.118 0 2026/2/10
10.0.5 0 2026/3/12
10.0.4 0 2026/3/10
10.0.3 0 2026/2/10
10.0.2 0 2026/1/13
10.0.1 0 2025/12/9
10.0.0 0 2025/11/11
10.0.0-rc.2.25502.107 0 2025/10/14
10.0.0-rc.1.25451.107 0 2025/9/9
10.0.0-preview.7.25380.108 0 2025/8/12
10.0.0-preview.6.25358.103 0 2025/7/15
10.0.0-preview.5.25277.114 0 2025/6/6
10.0.0-preview.4.25258.110 0 2025/5/12
10.0.0-preview.3.25171.6 0 2025/4/10
10.0.0-preview.2.25163.8 0 2025/3/18
10.0.0-preview.1.25081.1 0 2025/2/25
9.0.14 0 2026/3/10
9.0.13 1 2026/4/12
9.0.12 0 2026/1/13
9.0.11 0 2025/11/11
9.0.10 0 2025/10/14
9.0.9 0 2025/9/9
9.0.8 0 2025/8/5
9.0.7 0 2025/7/8
9.0.6 0 2025/6/10
9.0.5 0 2025/5/13
9.0.4 0 2025/4/8
9.0.3 1 2025/4/1
9.0.2 1 2026/4/12
9.0.1 0 2025/1/14
9.0.0 1 2024/12/10
9.0.0-rc.2.24474.1 0 2024/10/8
9.0.0-rc.1.24451.1 0 2024/9/10
9.0.0-preview.7.24405.3 0 2024/8/13
9.0.0-preview.6.24327.4 0 2024/7/9
9.0.0-preview.5.24306.3 0 2024/6/11
9.0.0-preview.4.24267.1 0 2024/5/21
9.0.0-preview.3.24172.4 0 2024/4/11
9.0.0-preview.2.24128.4 0 2024/3/12
9.0.0-preview.1.24081.2 0 2024/2/13
8.0.25 0 2026/3/10
8.0.24 0 2026/2/10
8.0.23 0 2026/1/13
8.0.22 0 2025/11/11
8.0.21 1 2026/4/12
8.0.20 0 2025/9/9
8.0.19 0 2025/8/5
8.0.18 0 2025/7/8
8.0.17 0 2025/6/10
8.0.16 0 2025/5/13
8.0.15 0 2025/4/8
8.0.14 0 2025/3/11
8.0.13 1 2026/4/12
8.0.12 0 2025/1/14
8.0.11 1 2025/4/29
8.0.10 0 2024/10/8
8.0.8 0 2024/8/13
8.0.7 0 2024/7/9
8.0.6 0 2024/5/28
8.0.5 0 2024/5/14
8.0.4 0 2024/4/9
8.0.3 0 2024/3/12
8.0.2 1 2026/4/12
8.0.1 0 2024/1/9
8.0.0 0 2023/11/14
8.0.0-rc.2.23480.1 0 2023/10/10
8.0.0-rc.1.23419.6 1 2026/4/9
8.0.0-preview.7.23375.4 0 2023/8/8
8.0.0-preview.6.23329.4 0 2023/7/11
8.0.0-preview.5.23280.1 0 2023/6/13
8.0.0-preview.4.23259.3 0 2023/5/16
8.0.0-preview.3.23174.2 0 2023/4/11
8.0.0-preview.2.23128.3 0 2023/3/14
8.0.0-preview.1.23111.4 0 2023/2/21
7.0.20 0 2024/5/28
7.0.19 0 2024/5/14
7.0.18 0 2024/4/9
7.0.17 0 2024/3/12
7.0.16 0 2024/2/13
7.0.15 0 2024/1/9
7.0.14 0 2023/11/14
7.0.13 0 2023/10/24
7.0.12 0 2023/10/10
7.0.11 0 2023/9/12
7.0.10 0 2023/8/8
7.0.9 0 2023/7/11
7.0.8 0 2023/6/22
7.0.7 0 2023/6/13
7.0.5 0 2023/4/11
7.0.4 0 2023/3/14
7.0.3 0 2023/2/14
7.0.2 1 2026/4/12
7.0.1 0 2022/12/13
7.0.0 0 2022/11/7
7.0.0-rc.2.22472.11 0 2022/10/11
7.0.0-rc.1.22426.7 0 2022/9/14
7.0.0-preview.7.22376.2 0 2022/8/9
7.0.0-preview.6.22329.4 0 2022/7/12
7.0.0-preview.5.22302.2 0 2022/6/14
7.0.0-preview.4.22229.2 0 2022/5/10
7.0.0-preview.3.22175.1 0 2022/4/13
7.0.0-preview.2.22153.1 0 2022/3/14
7.0.0-preview.1.22076.6 0 2022/2/17
6.0.36 1 2025/4/29
6.0.35 0 2024/10/8
6.0.33 0 2024/8/13
6.0.32 0 2024/7/9
6.0.31 0 2024/5/28
6.0.30 0 2024/5/14
6.0.29 0 2024/4/9
6.0.28 0 2024/3/12
6.0.27 0 2024/2/13
6.0.26 0 2024/1/9
6.0.25 0 2023/11/14
6.0.24 0 2023/10/24
6.0.23 1 2026/4/12
6.0.22 0 2023/9/12
6.0.21 1 2026/4/12
6.0.20 0 2023/7/11
6.0.19 0 2023/6/22
6.0.18 0 2023/6/13
6.0.16 0 2023/4/11
6.0.15 0 2023/3/14
6.0.14 0 2023/2/14
6.0.13 0 2023/1/10
6.0.12 0 2022/12/13
6.0.11 0 2022/11/7
6.0.10 0 2022/10/11
6.0.9 0 2022/9/13
6.0.8 0 2022/8/9
6.0.7 0 2022/7/12
6.0.6 0 2022/6/14
6.0.5 0 2022/5/10
6.0.4 0 2022/4/11
6.0.3 0 2022/3/8
6.0.2 1 2026/4/12
6.0.1 0 2021/12/14
6.0.0 2 2025/4/29
6.0.0-rc.2.21480.5 0 2021/10/12
6.0.0-rc.1.21452.10 0 2021/9/14
6.0.0-preview.7.21378.4 0 2021/8/10
6.0.0-preview.6.21352.1 0 2021/7/14
6.0.0-preview.5.21301.9 0 2021/6/15
6.0.0-preview.4.21253.1 0 2021/5/24
6.0.0-preview.3.21201.2 0 2021/4/8
6.0.0-preview.2.21154.2 0 2021/3/11
6.0.0-preview.1.21102.2 0 2021/2/12
5.0.17 0 2022/5/10
5.0.16 0 2022/4/11
5.0.15 0 2022/3/8
5.0.14 0 2022/2/8
5.0.13 1 2026/4/12
5.0.12 0 2021/11/7
5.0.11 0 2021/10/12
5.0.10 0 2021/9/14
5.0.9 0 2021/8/10
5.0.8 0 2021/7/13
5.0.7 0 2021/6/8
5.0.6 0 2021/5/11
5.0.5 0 2021/4/6
5.0.4 0 2021/3/9
5.0.3 0 2021/2/9
5.0.2 1 2026/4/12
5.0.1 0 2020/12/8
5.0.0 0 2020/11/9
5.0.0-rc.2.20475.6 0 2020/10/13
5.0.0-rc.1.20451.13 0 2020/9/14
5.0.0-preview.8.20407.4 0 2020/8/25
5.0.0-preview.7.20365.15 0 2020/7/21
5.0.0-preview.6.20312.4 0 2020/6/25
5.0.0-preview.5.20278.2 0 2020/6/10
5.0.0-preview.4.20220.10 0 2020/5/18
5.0.0-preview.3.20181.2 0 2020/4/23
5.0.0-preview.2.20159.4 0 2020/4/2
5.0.0-preview.2.20120.8 0 2020/3/16
3.1.32 0 2022/12/13
3.1.31 0 2022/11/8
3.1.30 0 2022/10/11
3.1.29 0 2022/9/13
3.1.28 0 2022/8/9
3.1.27 0 2022/7/12
3.1.26 0 2022/6/14
3.1.25 0 2022/5/10
3.1.24 0 2022/4/11
3.1.23 18 2025/2/26
3.1.22 21 2024/12/4
3.1.21 1 2026/4/12
3.1.20 0 2021/10/11
3.1.19 0 2021/9/14
3.1.18 27 2024/12/5
3.1.17 0 2021/7/13
3.1.16 0 2021/6/8
3.1.15 0 2021/5/11
3.1.14 0 2021/4/6
3.1.13 13 2025/3/1
3.1.12 0 2021/2/9
3.1.11 0 2021/1/12
3.1.10 3 2024/12/31
3.1.9 0 2020/10/13
3.1.8 0 2020/9/8
3.1.7 21 2025/2/28
3.1.6 0 2020/7/14
3.1.5 0 2020/6/9
3.1.4 0 2020/5/12
3.1.3 3 2025/9/20
3.1.2 1 2026/4/12
3.1.1 0 2020/1/14
3.1.0 2 2024/12/10
3.1.0-preview3.19554.8 0 2019/11/13
3.1.0-preview2.19525.5 0 2019/11/1
3.1.0-preview1.19506.2 0 2019/10/15
3.0.3 1 2026/4/12
3.0.2 0 2020/1/14
3.0.1 0 2019/11/18
3.0.0 0 2019/9/23
3.0.0-rc1.19456.14 0 2019/9/16
3.0.0-preview9.19423.6 0 2019/9/4
3.0.0-preview8.19405.11 0 2019/8/13
3.0.0-preview7.19362.6 0 2019/7/23
3.0.0-preview6.19304.10 1 2026/4/9
3.0.0-preview5.19227.1 0 2019/5/6
3.0.0-preview4.19216.3 0 2019/4/18
3.0.0-preview3.19153.1 1 2026/4/9
3.0.0-preview.19074.3 0 2019/1/29
3.0.0-preview.18572.1 0 2018/12/3
2.3.0 0 2025/1/14
2.2.6 5 2025/3/3
2.2.4 1 2026/4/12
2.2.3 1 2026/4/12
2.2.2 0 2019/2/12
2.2.1 0 2019/1/8
2.2.0 8 2024/12/9
2.2.0-preview3-35497 0 2018/10/17
2.2.0-preview2-35157 1 2026/4/11
2.2.0-preview1-35029 0 2018/8/22
2.1.14 0 2019/11/18
2.1.11 6 2025/3/3
2.1.8 0 2019/2/12
2.1.4 1 2026/4/12
2.1.3 1 2026/4/12
2.1.2 0 2018/8/21
2.1.1 0 2018/6/18
2.1.0 0 2018/5/29
2.1.0-rc1-final 0 2018/5/6
2.1.0-preview2-final 1 2026/4/12
2.1.0-preview1-final 0 2018/2/26
2.0.3 1 2026/4/12
2.0.2 1 2026/4/12
2.0.1 0 2017/11/14
2.0.0 0 2017/8/11
2.0.0-preview2-final 0 2017/6/28
2.0.0-preview1-final 0 2017/5/10
1.1.6 0 2018/7/10
1.1.5 0 2017/12/12
1.1.4 0 2017/11/14
1.1.3 0 2017/9/20
1.1.2 0 2017/5/9
1.1.1 0 2017/3/6
1.1.0 0 2016/11/16
1.1.0-preview1-final 0 2016/10/24
1.0.6 0 2017/11/14
1.0.5 0 2017/9/20
1.0.4 0 2017/5/9
1.0.3 0 2017/3/6
1.0.2 0 2016/12/12
1.0.1 0 2016/9/13
1.0.0 0 2016/6/27
1.0.0-rc2-final 0 2016/5/16