Microsoft.EntityFrameworkCore 10.0.4

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.AspNetCore.DataProtection.EntityFrameworkCore
Support for storing keys using Entity Framework Core. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/009e1ccafde4086ea52999e878f6e7aa5a7c4ccf
1 859
Microsoft.EntityFrameworkCore.InMemory
In-memory database provider for Entity Framework Core (to be used for testing purposes).
188
Microsoft.EntityFrameworkCore.InMemory
In-memory database provider for Entity Framework Core (to be used for testing purposes).
535
Microsoft.EntityFrameworkCore.InMemory
In-memory database provider for Entity Framework Core (to be used for testing purposes).
708
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
42
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
43
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
64
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
69
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
70
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
91
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.
148
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
254
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
311
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
395
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
461
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
1 035
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
1 590
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
5 676
Npgsql.EntityFrameworkCore.PostgreSQL
PostgreSQL/Npgsql provider for Entity Framework Core.
341

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