Microsoft.EntityFrameworkCore 9.0.0-preview.7.24405.3

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.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
57
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
51
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
50
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
49
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
47
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
46
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
46
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
46
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
45
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
45
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
44
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
44
Microsoft.EntityFrameworkCore.Relational
Shared Entity Framework Core components for relational database providers.
43
Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore
Contains Entity Framework Core Services used by ASP.NET Core Code Generators.
43

.NET 8.0

Version Downloads Last updated
9.0.0 7 11/12/2024
9.0.0-rc.2.24474.1 6 10/11/2024
9.0.0-rc.1.24451.1 11 9/11/2024
9.0.0-preview.7.24405.3 13 8/14/2024
9.0.0-preview.6.24327.4 19 7/10/2024
9.0.0-preview.5.24306.3 14 6/14/2024
9.0.0-preview.4.24267.1 15 5/25/2024
9.0.0-preview.3.24172.4 17 4/14/2024
9.0.0-preview.2.24128.4 18 3/21/2024
9.0.0-preview.1.24081.2 27 2/21/2024
8.0.11 2 11/13/2024
8.0.10 5 10/12/2024
8.0.8 10 8/13/2024
8.0.7 19 7/9/2024
8.0.6 13 5/29/2024
8.0.5 16 5/23/2024
8.0.4 16 4/10/2024
8.0.3 28 3/20/2024
8.0.2 20 2/22/2024
8.0.1 21 1/11/2024
8.0.0 22 11/15/2023
8.0.0-rc.2.23480.1 37 10/13/2023
8.0.0-rc.1.23419.6 34 9/15/2023
8.0.0-preview.7.23375.4 32 8/22/2023
8.0.0-preview.6.23329.4 35 7/31/2023
8.0.0-preview.5.23280.1 40 7/31/2023
8.0.0-preview.4.23259.3 36 5/20/2023
8.0.0-preview.3.23174.2 40 5/14/2023
8.0.0-preview.2.23128.3 39 7/31/2023
8.0.0-preview.1.23111.4 51 2/23/2023
7.0.20 11 5/29/2024
7.0.19 15 5/23/2024
7.0.18 15 4/10/2024
7.0.17 20 3/20/2024
7.0.16 25 2/22/2024
7.0.15 23 1/15/2024
7.0.14 27 11/15/2023
7.0.13 33 10/28/2023
7.0.12 24 10/10/2023
7.0.11 26 9/16/2023
7.0.10 30 8/20/2023
7.0.9 38 7/31/2023
7.0.8 28 7/31/2023
7.0.7 31 7/31/2023
7.0.5 32 5/12/2023
7.0.4 25 5/12/2023
7.0.3 26 2/21/2023
7.0.2 29 2/21/2023
7.0.1 47 2/14/2023
7.0.0 42 12/3/2022
7.0.0-rc.2.22472.11 38 11/9/2022
7.0.0-rc.1.22426.7 44 9/15/2022
7.0.0-preview.7.22376.2 29 9/11/2022
7.0.0-preview.6.22329.4 36 9/14/2022
7.0.0-preview.5.22302.2 48 6/27/2022
7.0.0-preview.4.22229.2 48 6/30/2022
7.0.0-preview.3.22175.1 50 6/30/2022
7.0.0-preview.2.22153.1 42 6/30/2022
7.0.0-preview.1.22076.6 40 6/30/2022
6.0.36 2 11/13/2024
6.0.35 5 10/11/2024
6.0.33 11 8/14/2024
6.0.32 21 7/9/2024
6.0.31 13 5/29/2024
6.0.30 15 5/19/2024
6.0.29 17 4/10/2024
6.0.28 24 3/20/2024
6.0.27 26 2/22/2024
6.0.26 22 1/15/2024
6.0.25 27 11/16/2023
6.0.24 29 10/28/2023
6.0.23 27 10/10/2023
6.0.22 25 9/17/2023
6.0.21 25 8/22/2023
6.0.20 31 7/31/2023
6.0.19 33 7/31/2023
6.0.18 27 7/31/2023
6.0.16 35 5/12/2023
6.0.15 36 3/16/2023
6.0.14 26 2/21/2023
6.0.13 38 2/9/2023
6.0.12 45 12/30/2022
6.0.11 38 12/3/2022
6.0.10 34 12/3/2022
6.0.9 35 9/14/2022
6.0.8 29 9/14/2022
6.0.7 45 7/26/2022
6.0.6 36 6/30/2022
6.0.5 37 6/30/2022
6.0.4 27 6/30/2022
6.0.3 35 6/30/2022
6.0.2 30 6/30/2022
6.0.1 28 6/30/2022
6.0.0 52 6/30/2022
6.0.0-rc.2.21480.5 38 6/30/2022
6.0.0-rc.1.21452.10 35 6/30/2022
6.0.0-preview.7.21378.4 48 6/30/2022
6.0.0-preview.6.21352.1 41 6/30/2022
6.0.0-preview.5.21301.9 55 6/30/2022
6.0.0-preview.4.21253.1 45 6/30/2022
6.0.0-preview.3.21201.2 40 6/30/2022
6.0.0-preview.2.21154.2 41 6/30/2022
6.0.0-preview.1.21102.2 38 6/30/2022
5.0.17 40 6/30/2022
5.0.16 36 6/30/2022
5.0.15 50 6/30/2022
5.0.14 38 6/30/2022
5.0.13 39 6/30/2022
5.0.12 36 6/30/2022
5.0.11 44 6/30/2022
5.0.10 46 6/30/2022
5.0.9 43 6/30/2022
5.0.8 31 6/30/2022
5.0.7 46 6/30/2022
5.0.6 36 6/30/2022
5.0.5 34 6/30/2022
5.0.4 35 6/30/2022
5.0.3 38 6/30/2022
5.0.2 33 6/30/2022
5.0.1 34 6/30/2022
5.0.0 35 6/30/2022
5.0.0-rc.2.20475.6 33 6/30/2022
5.0.0-rc.1.20451.13 47 6/30/2022
5.0.0-preview.8.20407.4 44 6/30/2022
5.0.0-preview.7.20365.15 39 6/30/2022
5.0.0-preview.6.20312.4 65 6/30/2022
5.0.0-preview.5.20278.2 40 6/30/2022
5.0.0-preview.4.20220.10 36 6/30/2022
5.0.0-preview.3.20181.2 33 6/30/2022
5.0.0-preview.2.20159.4 29 6/30/2022
5.0.0-preview.2.20120.8 40 6/30/2022
3.1.32 38 2/1/2023
3.1.31 38 12/3/2022
3.1.30 40 11/7/2022
3.1.29 36 9/14/2022
3.1.28 33 9/14/2022
3.1.27 33 9/14/2022
3.1.26 35 6/30/2022
3.1.25 31 6/30/2022
3.1.24 38 6/30/2022
3.1.23 47 6/30/2022
3.1.22 40 6/30/2022
3.1.21 29 6/30/2022
3.1.20 33 6/30/2022
3.1.19 30 6/30/2022
3.1.18 37 6/30/2022
3.1.17 40 6/30/2022
3.1.16 37 6/30/2022
3.1.15 33 6/30/2022
3.1.14 36 6/30/2022
3.1.13 50 6/30/2022
3.1.12 35 6/30/2022
3.1.11 39 6/30/2022
3.1.10 30 6/30/2022
3.1.9 34 6/30/2022
3.1.8 29 6/30/2022
3.1.7 36 6/30/2022
3.1.6 37 6/30/2022
3.1.5 32 6/30/2022
3.1.4 37 6/30/2022
3.1.3 36 6/30/2022
3.1.2 36 6/30/2022
3.1.1 31 6/30/2022
3.1.0 44 6/30/2022
3.1.0-preview3.19554.8 45 6/30/2022
3.1.0-preview2.19525.5 43 6/30/2022
3.1.0-preview1.19506.2 33 6/30/2022
3.0.3 31 6/30/2022
3.0.2 39 6/30/2022
3.0.1 39 6/30/2022
3.0.0 36 6/30/2022
3.0.0-rc1.19456.14 48 6/30/2022
3.0.0-preview9.19423.6 40 6/30/2022
3.0.0-preview8.19405.11 39 6/30/2022
3.0.0-preview7.19362.6 52 6/30/2022
3.0.0-preview6.19304.10 47 6/30/2022
3.0.0-preview5.19227.1 30 6/30/2022
3.0.0-preview4.19216.3 31 6/30/2022
3.0.0-preview3.19153.1 46 6/30/2022
3.0.0-preview.19074.3 42 6/30/2022
3.0.0-preview.18572.1 37 6/30/2022
2.2.6 30 6/30/2022
2.2.4 40 6/30/2022
2.2.3 49 6/30/2022
2.2.2 29 6/30/2022
2.2.1 40 6/30/2022
2.2.0 32 6/30/2022
2.2.0-preview3-35497 44 6/30/2022
2.2.0-preview2-35157 42 6/30/2022
2.2.0-preview1-35029 47 6/30/2022
2.1.14 31 6/30/2022
2.1.11 49 6/30/2022
2.1.8 54 6/30/2022
2.1.4 39 6/30/2022
2.1.3 30 6/30/2022
2.1.2 51 6/30/2022
2.1.1 32 6/30/2022
2.1.0 40 6/30/2022
2.1.0-rc1-final 34 6/30/2022
2.1.0-preview2-final 37 6/30/2022
2.1.0-preview1-final 44 6/30/2022
2.0.3 33 6/30/2022
2.0.2 25 6/30/2022
2.0.1 34 6/30/2022
2.0.0 36 6/30/2022
2.0.0-preview2-final 39 6/30/2022
2.0.0-preview1-final 44 6/30/2022
1.1.6 31 6/30/2022
1.1.5 44 6/30/2022
1.1.4 44 6/30/2022
1.1.3 38 6/30/2022
1.1.2 39 6/30/2022
1.1.1 48 6/30/2022
1.1.0 38 6/30/2022
1.1.0-preview1-final 38 6/30/2022
1.0.6 48 6/30/2022
1.0.5 38 6/30/2022
1.0.4 30 6/30/2022
1.0.3 35 6/30/2022
1.0.2 33 6/30/2022
1.0.1 40 6/30/2022
1.0.0 46 6/30/2022
1.0.0-rc2-final 34 6/30/2022