Microsoft.EntityFrameworkCore 8.0.24

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
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
132
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
132
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
131
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
130
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
128
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
128
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
127
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
126
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
124
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/8e7402701ea1416b7fe55e1863ae65b3147c02c7
124
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
122
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
121
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/7cd2eb79628a2511af8e8d2699c29380909ab004
121
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
120
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
119
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
119
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
118

Version Downloads Last updated
11.0.0-preview.2.26159.112 4 3/12/2026
11.0.0-preview.1.26104.118 8 2/12/2026
10.0.5 3 3/14/2026
10.0.4 4 3/12/2026
10.0.3 5 2/12/2026
10.0.2 13 1/15/2026
10.0.1 18 12/10/2025
10.0.0 41 11/12/2025
10.0.0-rc.2.25502.107 51 10/15/2025
10.0.0-rc.1.25451.107 62 9/10/2025
10.0.0-preview.7.25380.108 62 8/12/2025
10.0.0-preview.6.25358.103 69 7/15/2025
10.0.0-preview.5.25277.114 57 6/8/2025
10.0.0-preview.4.25258.110 84 5/16/2025
10.0.0-preview.3.25171.6 74 4/12/2025
10.0.0-preview.2.25163.8 79 3/18/2025
10.0.0-preview.1.25081.1 78 2/28/2025
9.0.14 4 3/12/2026
9.0.13 6 2/12/2026
9.0.12 10 1/15/2026
9.0.11 35 11/12/2025
9.0.10 51 10/15/2025
9.0.9 72 9/10/2025
9.0.8 61 8/5/2025
9.0.7 79 7/11/2025
9.0.6 79 6/15/2025
9.0.5 73 5/17/2025
9.0.4 79 4/8/2025
9.0.3 91 3/13/2025
9.0.2 97 2/15/2025
9.0.1 101 1/18/2025
9.0.0 96 11/12/2024
9.0.0-rc.2.24474.1 93 10/11/2024
9.0.0-rc.1.24451.1 87 9/11/2024
9.0.0-preview.7.24405.3 91 8/14/2024
9.0.0-preview.6.24327.4 91 7/10/2024
9.0.0-preview.5.24306.3 108 6/14/2024
9.0.0-preview.4.24267.1 95 5/25/2024
9.0.0-preview.3.24172.4 89 4/14/2024
9.0.0-preview.2.24128.4 95 3/21/2024
9.0.0-preview.1.24081.2 99 2/21/2024
8.0.25 4 3/12/2026
8.0.24 3 2/12/2026
8.0.23 9 1/15/2026
8.0.22 30 11/12/2025
8.0.21 49 10/15/2025
8.0.20 54 9/10/2025
8.0.19 47 8/6/2025
8.0.18 71 7/11/2025
8.0.17 66 6/15/2025
8.0.16 75 5/17/2025
8.0.15 77 4/9/2025
8.0.14 72 3/13/2025
8.0.13 73 2/20/2025
8.0.12 79 1/18/2025
8.0.11 87 11/13/2024
8.0.10 98 10/12/2024
8.0.8 80 8/13/2024
8.0.7 94 7/9/2024
8.0.6 97 5/29/2024
8.0.5 89 5/23/2024
8.0.4 92 4/10/2024
8.0.3 114 3/20/2024
8.0.2 95 2/22/2024
8.0.1 104 1/11/2024
8.0.0 101 11/15/2023
8.0.0-rc.2.23480.1 112 10/13/2023
8.0.0-rc.1.23419.6 118 9/15/2023
8.0.0-preview.7.23375.4 113 8/22/2023
8.0.0-preview.6.23329.4 112 7/31/2023
8.0.0-preview.5.23280.1 110 7/31/2023
8.0.0-preview.4.23259.3 119 5/20/2023
8.0.0-preview.3.23174.2 106 5/14/2023
8.0.0-preview.2.23128.3 117 7/31/2023
8.0.0-preview.1.23111.4 140 2/23/2023
7.0.20 92 5/29/2024
7.0.19 88 5/23/2024
7.0.18 101 4/10/2024
7.0.17 99 3/20/2024
7.0.16 98 2/22/2024
7.0.15 88 1/15/2024
7.0.14 110 11/15/2023
7.0.13 107 10/28/2023
7.0.12 110 10/10/2023
7.0.11 95 9/16/2023
7.0.10 112 8/20/2023
7.0.9 117 7/31/2023
7.0.8 107 7/31/2023
7.0.7 114 7/31/2023
7.0.5 115 5/12/2023
7.0.4 108 5/12/2023
7.0.3 99 2/21/2023
7.0.2 101 2/21/2023
7.0.1 128 2/14/2023
7.0.0 111 12/3/2022
7.0.0-rc.2.22472.11 111 11/9/2022
7.0.0-rc.1.22426.7 117 9/15/2022
7.0.0-preview.7.22376.2 93 9/11/2022
7.0.0-preview.6.22329.4 119 9/14/2022
7.0.0-preview.5.22302.2 134 6/27/2022
7.0.0-preview.4.22229.2 119 6/30/2022
7.0.0-preview.3.22175.1 123 6/30/2022
7.0.0-preview.2.22153.1 121 6/30/2022
7.0.0-preview.1.22076.6 115 6/30/2022
6.0.36 84 11/13/2024
6.0.35 90 10/11/2024
6.0.33 92 8/14/2024
6.0.32 105 7/9/2024
6.0.31 101 5/29/2024
6.0.30 100 5/19/2024
6.0.29 102 4/10/2024
6.0.28 106 3/20/2024
6.0.27 101 2/22/2024
6.0.26 89 1/15/2024
6.0.25 103 11/16/2023
6.0.24 95 10/28/2023
6.0.23 107 10/10/2023
6.0.22 105 9/17/2023
6.0.21 100 8/22/2023
6.0.20 101 7/31/2023
6.0.19 137 7/31/2023
6.0.18 110 7/31/2023
6.0.16 116 5/12/2023
6.0.15 113 3/16/2023
6.0.14 102 2/21/2023
6.0.13 122 2/9/2023
6.0.12 121 12/30/2022
6.0.11 116 12/3/2022
6.0.10 106 12/3/2022
6.0.9 112 9/14/2022
6.0.8 109 9/14/2022
6.0.7 150 7/26/2022
6.0.6 113 6/30/2022
6.0.5 108 6/30/2022
6.0.4 102 6/30/2022
6.0.3 109 6/30/2022
6.0.2 116 6/30/2022
6.0.1 97 6/30/2022
6.0.0 132 6/30/2022
6.0.0-rc.2.21480.5 118 6/30/2022
6.0.0-rc.1.21452.10 114 6/30/2022
6.0.0-preview.7.21378.4 128 6/30/2022
6.0.0-preview.6.21352.1 117 6/30/2022
6.0.0-preview.5.21301.9 143 6/30/2022
6.0.0-preview.4.21253.1 116 6/30/2022
6.0.0-preview.3.21201.2 110 6/30/2022
6.0.0-preview.2.21154.2 124 6/30/2022
6.0.0-preview.1.21102.2 127 6/30/2022
5.0.17 119 6/30/2022
5.0.16 119 6/30/2022
5.0.15 137 6/30/2022
5.0.14 124 6/30/2022
5.0.13 116 6/30/2022
5.0.12 115 6/30/2022
5.0.11 112 6/30/2022
5.0.10 133 6/30/2022
5.0.9 132 6/30/2022
5.0.8 103 6/30/2022
5.0.7 123 6/30/2022
5.0.6 109 6/30/2022
5.0.5 111 6/30/2022
5.0.4 116 6/30/2022
5.0.3 106 6/30/2022
5.0.2 107 6/30/2022
5.0.1 118 6/30/2022
5.0.0 108 6/30/2022
5.0.0-rc.2.20475.6 102 6/30/2022
5.0.0-rc.1.20451.13 130 6/30/2022
5.0.0-preview.8.20407.4 120 6/30/2022
5.0.0-preview.7.20365.15 110 6/30/2022
5.0.0-preview.6.20312.4 143 6/30/2022
5.0.0-preview.5.20278.2 110 6/30/2022
5.0.0-preview.4.20220.10 105 6/30/2022
5.0.0-preview.3.20181.2 105 6/30/2022
5.0.0-preview.2.20159.4 104 6/30/2022
5.0.0-preview.2.20120.8 114 6/30/2022
3.1.32 122 2/1/2023
3.1.31 102 12/3/2022
3.1.30 113 11/7/2022
3.1.29 108 9/14/2022
3.1.28 117 9/14/2022
3.1.27 109 9/14/2022
3.1.26 109 6/30/2022
3.1.25 101 6/30/2022
3.1.24 108 6/30/2022
3.1.23 118 6/30/2022
3.1.22 110 6/30/2022
3.1.21 102 6/30/2022
3.1.20 105 6/30/2022
3.1.19 107 6/30/2022
3.1.18 108 6/30/2022
3.1.17 120 6/30/2022
3.1.16 106 6/30/2022
3.1.15 102 6/30/2022
3.1.14 117 6/30/2022
3.1.13 126 6/30/2022
3.1.12 107 6/30/2022
3.1.11 115 6/30/2022
3.1.10 99 6/30/2022
3.1.9 106 6/30/2022
3.1.8 112 6/30/2022
3.1.7 110 6/30/2022
3.1.6 119 6/30/2022
3.1.5 102 6/30/2022
3.1.4 116 6/30/2022
3.1.3 109 6/30/2022
3.1.2 110 6/30/2022
3.1.1 111 6/30/2022
3.1.0 124 6/30/2022
3.1.0-preview3.19554.8 115 6/30/2022
3.1.0-preview2.19525.5 119 6/30/2022
3.1.0-preview1.19506.2 104 6/30/2022
3.0.3 109 6/30/2022
3.0.2 123 6/30/2022
3.0.1 124 6/30/2022
3.0.0 122 6/30/2022
3.0.0-rc1.19456.14 138 6/30/2022
3.0.0-preview9.19423.6 117 6/30/2022
3.0.0-preview8.19405.11 110 6/30/2022
3.0.0-preview7.19362.6 128 6/30/2022
3.0.0-preview6.19304.10 126 6/30/2022
3.0.0-preview5.19227.1 102 6/30/2022
3.0.0-preview4.19216.3 113 6/30/2022
3.0.0-preview3.19153.1 120 6/30/2022
3.0.0-preview.19074.3 116 6/30/2022
3.0.0-preview.18572.1 120 6/30/2022
2.3.0 93 1/21/2025
2.2.6 104 6/30/2022
2.2.4 110 6/30/2022
2.2.3 121 6/30/2022
2.2.2 104 6/30/2022
2.2.1 128 6/30/2022
2.2.0 105 6/30/2022
2.2.0-preview3-35497 124 6/30/2022
2.2.0-preview2-35157 126 6/30/2022
2.2.0-preview1-35029 142 6/30/2022
2.1.14 98 6/30/2022
2.1.11 129 6/30/2022
2.1.8 135 6/30/2022
2.1.4 105 6/30/2022
2.1.3 101 6/30/2022
2.1.2 140 6/30/2022
2.1.1 102 6/30/2022
2.1.0 128 6/30/2022
2.1.0-rc1-final 103 6/30/2022
2.1.0-preview2-final 111 6/30/2022
2.1.0-preview1-final 118 6/30/2022
2.0.3 102 6/30/2022
2.0.2 106 6/30/2022
2.0.1 111 6/30/2022
2.0.0 108 6/30/2022
2.0.0-preview2-final 105 6/30/2022
2.0.0-preview1-final 120 6/30/2022
1.1.6 103 6/30/2022
1.1.5 129 6/30/2022
1.1.4 124 6/30/2022
1.1.3 113 6/30/2022
1.1.2 120 6/30/2022
1.1.1 137 6/30/2022
1.1.0 112 6/30/2022
1.1.0-preview1-final 106 6/30/2022
1.0.6 133 6/30/2022
1.0.5 107 6/30/2022
1.0.4 100 6/30/2022
1.0.3 108 6/30/2022
1.0.2 114 6/30/2022
1.0.1 113 6/30/2022
1.0.0 130 6/30/2022
1.0.0-rc2-final 111 6/30/2022