Microsoft.EntityFrameworkCore 9.0.3

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.

Requires NuGet 3.6 or higher.

dotnet add package Microsoft.EntityFrameworkCore --version 9.0.3
                    
NuGet\Install-Package Microsoft.EntityFrameworkCore -Version 9.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.EntityFrameworkCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.EntityFrameworkCore --version 9.0.3
                    
#r "nuget: Microsoft.EntityFrameworkCore, 9.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Microsoft.EntityFrameworkCore&version=9.0.3
                    
Install Microsoft.EntityFrameworkCore as a Cake Addin
#tool nuget:?package=Microsoft.EntityFrameworkCore&version=9.0.3
                    
Install Microsoft.EntityFrameworkCore as a Cake Tool

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.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (8.7K)

Showing the top 5 NuGet packages that depend on Microsoft.EntityFrameworkCore:

Package Downloads
Microsoft.EntityFrameworkCore.Relational

Shared Entity Framework Core components for relational database providers.

Microsoft.EntityFrameworkCore.InMemory

In-memory database provider for Entity Framework Core (to be used for testing purposes).

Npgsql.EntityFrameworkCore.PostgreSQL

PostgreSQL/Npgsql provider for Entity Framework Core.

Microsoft.EntityFrameworkCore.Proxies

Lazy loading proxies for Entity Framework Core.

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.

GitHub repositories (621)

Showing the top 5 popular GitHub repositories that depend on Microsoft.EntityFrameworkCore:

Repository Stars
jasontaylordev/CleanArchitecture
Clean Architecture Solution Template for ASP.NET Core
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
aspnetboilerplate/aspnetboilerplate
ASP.NET Boilerplate - Web Application Framework
kgrzybek/modular-monolith-with-ddd
Full Modular Monolith application with Domain-Driven Design approach.
Version Downloads Last updated
10.0.0-preview.2.25163.8 5,189 3/18/2025
10.0.0-preview.1.25081.1 11,277 2/25/2025
9.0.3 1,236,331 3/11/2025
9.0.2 3,130,415 2/11/2025
9.0.1 4,706,616 1/14/2025
9.0.0 9,798,797 11/12/2024
9.0.0-rc.2.24474.1 188,317 10/8/2024
9.0.0-rc.1.24451.1 121,603 9/10/2024
9.0.0-preview.7.24405.3 78,101 8/13/2024
9.0.0-preview.6.24327.4 111,119 7/9/2024
9.0.0-preview.5.24306.3 42,563 6/11/2024
9.0.0-preview.4.24267.1 57,351 5/21/2024
9.0.0-preview.3.24172.4 169,674 4/11/2024
9.0.0-preview.2.24128.4 65,405 3/12/2024
9.0.0-preview.1.24081.2 100,824 2/13/2024
8.0.14 575,970 3/11/2025
8.0.13 1,654,969 2/11/2025
8.0.12 2,348,332 1/14/2025
8.0.11 10,815,887 11/12/2024
8.0.10 15,946,728 10/8/2024
8.0.8 21,008,485 8/13/2024
8.0.7 13,467,813 7/9/2024
8.0.6 15,644,970 5/28/2024
8.0.5 6,789,592 5/14/2024
8.0.4 24,857,466 4/9/2024
8.0.3 10,549,989 3/12/2024
8.0.2 20,379,183 2/13/2024
8.0.1 13,433,569 1/9/2024
8.0.0 38,668,043 11/14/2023
8.0.0-rc.2.23480.1 510,504 10/10/2023
8.0.0-rc.1.23419.6 143,093 9/12/2023
8.0.0-preview.7.23375.4 112,508 8/8/2023
8.0.0-preview.6.23329.4 192,012 7/11/2023
8.0.0-preview.5.23280.1 174,034 6/13/2023
8.0.0-preview.4.23259.3 133,663 5/16/2023
8.0.0-preview.3.23174.2 222,173 4/11/2023
8.0.0-preview.2.23128.3 194,302 3/14/2023
8.0.0-preview.1.23111.4 138,231 2/21/2023
7.0.20 2,932,939 5/28/2024
7.0.19 486,376 5/14/2024
7.0.18 2,105,882 4/9/2024
7.0.17 1,557,332 3/12/2024
7.0.16 1,985,401 2/13/2024
7.0.15 3,100,151 1/9/2024
7.0.14 5,881,524 11/14/2023
7.0.13 6,487,597 10/24/2023
7.0.12 4,315,739 10/10/2023
7.0.11 13,143,491 9/12/2023
7.0.10 9,458,244 8/8/2023
7.0.9 8,788,990 7/11/2023
7.0.8 5,380,086 6/22/2023
7.0.7 3,710,251 6/13/2023
7.0.5 25,079,941 4/11/2023
7.0.4 9,278,285 3/14/2023
7.0.3 13,552,384 2/14/2023
7.0.2 18,361,487 1/10/2023
7.0.1 9,856,422 12/13/2022
7.0.0 28,925,226 11/7/2022
7.0.0-rc.2.22472.11 217,829 10/11/2022
7.0.0-rc.1.22426.7 213,439 9/14/2022
7.0.0-preview.7.22376.2 97,051 8/9/2022
7.0.0-preview.6.22329.4 76,065 7/12/2022
7.0.0-preview.5.22302.2 64,581 6/14/2022
7.0.0-preview.4.22229.2 83,208 5/10/2022
7.0.0-preview.3.22175.1 78,215 4/13/2022
7.0.0-preview.2.22153.1 86,023 3/14/2022
7.0.0-preview.1.22076.6 58,166 2/17/2022
6.0.36 809,744 11/12/2024
6.0.35 549,603 10/8/2024
6.0.33 1,502,772 8/13/2024
6.0.32 710,883 7/9/2024
6.0.31 990,653 5/28/2024
6.0.30 518,081 5/14/2024
6.0.29 2,492,492 4/9/2024
6.0.28 1,462,015 3/12/2024
6.0.27 1,765,668 2/13/2024
6.0.26 2,534,547 1/9/2024
6.0.25 3,493,440 11/14/2023
6.0.24 1,819,825 10/24/2023
6.0.23 1,206,699 10/10/2023
6.0.22 3,280,185 9/12/2023
6.0.21 3,477,322 8/8/2023
6.0.20 2,795,562 7/11/2023
6.0.19 2,348,027 6/22/2023
6.0.18 1,249,997 6/13/2023
6.0.16 7,394,163 4/11/2023
6.0.15 4,092,331 3/14/2023
6.0.14 5,182,878 2/14/2023
6.0.13 6,811,066 1/10/2023
6.0.12 10,612,821 12/13/2022
6.0.11 9,740,519 11/7/2022
6.0.10 17,216,721 10/11/2022
6.0.9 15,064,484 9/13/2022
6.0.8 18,095,648 8/9/2022
6.0.7 48,871,663 7/12/2022
6.0.6 14,523,647 6/14/2022
6.0.5 22,170,637 5/10/2022
6.0.4 17,688,450 4/11/2022
6.0.3 24,207,456 3/8/2022
6.0.2 19,525,589 2/8/2022
6.0.1 32,295,367 12/14/2021
6.0.0 66,874,847 11/8/2021
6.0.0-rc.2.21480.5 323,228 10/12/2021
6.0.0-rc.1.21452.10 262,714 9/14/2021
6.0.0-preview.7.21378.4 96,529 8/10/2021
6.0.0-preview.6.21352.1 43,649 7/14/2021
6.0.0-preview.5.21301.9 186,351 6/15/2021
6.0.0-preview.4.21253.1 72,738 5/24/2021
6.0.0-preview.3.21201.2 96,728 4/8/2021
6.0.0-preview.2.21154.2 73,037 3/11/2021
6.0.0-preview.1.21102.2 95,443 2/12/2021
5.0.17 7,565,819 5/10/2022 5.0.17 is deprecated because it is no longer maintained.
5.0.16 1,487,245 4/11/2022 5.0.16 is deprecated because it is no longer maintained.
5.0.15 2,325,392 3/8/2022 5.0.15 is deprecated because it is no longer maintained.
5.0.14 2,347,830 2/8/2022 5.0.14 is deprecated because it is no longer maintained.
5.0.13 4,427,770 12/14/2021 5.0.13 is deprecated because it is no longer maintained.
5.0.12 4,812,292 11/7/2021 5.0.12 is deprecated because it is no longer maintained.
5.0.11 8,367,965 10/12/2021 5.0.11 is deprecated because it is no longer maintained.
5.0.10 13,342,404 9/14/2021 5.0.10 is deprecated because it is no longer maintained.
5.0.9 10,265,551 8/10/2021 5.0.9 is deprecated because it is no longer maintained.
5.0.8 9,555,746 7/13/2021 5.0.8 is deprecated because it is no longer maintained.
5.0.7 14,341,744 6/8/2021 5.0.7 is deprecated because it is no longer maintained.
5.0.6 8,169,450 5/11/2021 5.0.6 is deprecated because it is no longer maintained.
5.0.5 11,384,330 4/6/2021 5.0.5 is deprecated because it is no longer maintained.
5.0.4 8,260,973 3/9/2021 5.0.4 is deprecated because it is no longer maintained.
5.0.3 8,059,469 2/9/2021 5.0.3 is deprecated because it is no longer maintained.
5.0.2 10,502,924 1/12/2021 5.0.2 is deprecated because it is no longer maintained.
5.0.1 15,871,738 12/8/2020 5.0.1 is deprecated because it is no longer maintained.
5.0.0 26,517,359 11/9/2020 5.0.0 is deprecated because it is no longer maintained.
5.0.0-rc.2.20475.6 379,787 10/13/2020
5.0.0-rc.1.20451.13 318,717 9/14/2020
5.0.0-preview.8.20407.4 202,516 8/25/2020
5.0.0-preview.7.20365.15 114,391 7/21/2020
5.0.0-preview.6.20312.4 63,888 6/25/2020
5.0.0-preview.5.20278.2 49,133 6/10/2020
5.0.0-preview.4.20220.10 73,710 5/18/2020
5.0.0-preview.3.20181.2 94,509 4/23/2020
5.0.0-preview.2.20159.4 61,565 4/2/2020
5.0.0-preview.2.20120.8 46,062 3/16/2020
3.1.32 5,481,355 12/13/2022
3.1.31 1,070,856 11/8/2022
3.1.30 732,709 10/11/2022
3.1.29 1,261,000 9/13/2022
3.1.28 838,923 8/9/2022
3.1.27 743,628 7/12/2022
3.1.26 647,960 6/14/2022
3.1.25 1,085,432 5/10/2022
3.1.24 654,614 4/11/2022
3.1.23 1,065,186 3/8/2022
3.1.22 3,414,724 12/14/2021
3.1.21 2,625,699 11/7/2021
3.1.20 1,560,574 10/11/2021
3.1.19 2,469,397 9/14/2021
3.1.18 5,281,719 8/10/2021
3.1.17 1,889,800 7/13/2021
3.1.16 2,383,253 6/8/2021
3.1.15 2,836,261 5/11/2021
3.1.14 3,114,621 4/6/2021
3.1.13 4,603,778 3/9/2021
3.1.12 3,009,485 2/9/2021
3.1.11 5,453,123 1/12/2021
3.1.10 8,350,718 11/9/2020
3.1.9 12,038,830 10/13/2020
3.1.8 17,720,744 9/8/2020
3.1.7 10,070,893 8/11/2020
3.1.6 10,794,859 7/14/2020
3.1.5 12,845,083 6/9/2020
3.1.4 17,945,130 5/12/2020
3.1.3 27,978,965 3/24/2020
3.1.2 11,924,902 2/19/2020
3.1.1 20,009,045 1/14/2020
3.1.0 34,232,102 12/3/2019
3.1.0-preview3.19554.8 164,672 11/13/2019
3.1.0-preview2.19525.5 32,723 11/1/2019
3.1.0-preview1.19506.2 759,154 10/15/2019
3.0.3 189,043 2/19/2020
3.0.2 80,090 1/14/2020
3.0.1 1,403,438 11/18/2019
3.0.0 19,027,147 9/23/2019
3.0.0-rc1.19456.14 46,661 9/16/2019
3.0.0-preview9.19423.6 1,379,052 9/4/2019
3.0.0-preview8.19405.11 412,591 8/13/2019
3.0.0-preview7.19362.6 90,436 7/23/2019
3.0.0-preview6.19304.10 167,949 6/12/2019
3.0.0-preview5.19227.1 671,498 5/6/2019
3.0.0-preview4.19216.3 22,929 4/18/2019
3.0.0-preview3.19153.1 202,250 3/6/2019
3.0.0-preview.19074.3 31,550 1/29/2019
3.0.0-preview.18572.1 48,495 12/3/2018
2.3.0 7,992 1/14/2025
2.2.6 31,695,520 7/9/2019 2.2.6 is deprecated because it is no longer maintained.
2.2.4 19,523,990 4/9/2019 2.2.4 is deprecated because it is no longer maintained.
2.2.3 5,333,640 3/11/2019 2.2.3 is deprecated because it is no longer maintained.
2.2.2 6,428,264 2/12/2019 2.2.2 is deprecated because it is no longer maintained.
2.2.1 6,884,553 1/8/2019 2.2.1 is deprecated because it is no longer maintained.
2.2.0 21,636,447 12/3/2018 2.2.0 is deprecated because it is no longer maintained.
2.2.0-preview3-35497 184,781 10/17/2018
2.2.0-preview2-35157 148,668 9/12/2018
2.2.0-preview1-35029 81,707 8/22/2018
2.1.14 3,955,824 11/18/2019
2.1.11 3,696,323 5/14/2019
2.1.8 3,749,291 2/12/2019
2.1.4 15,537,647 10/1/2018
2.1.3 4,888,181 9/11/2018
2.1.2 8,098,591 8/21/2018
2.1.1 16,282,915 6/18/2018
2.1.0 13,246,717 5/29/2018
2.1.0-rc1-final 224,078 5/6/2018
2.1.0-preview2-final 205,185 4/10/2018
2.1.0-preview1-final 316,525 2/26/2018
2.0.3 5,331,567 5/7/2018 2.0.3 is deprecated because it is no longer maintained.
2.0.2 6,661,532 3/13/2018 2.0.2 is deprecated because it is no longer maintained.
2.0.1 12,489,644 11/14/2017 2.0.1 is deprecated because it is no longer maintained.
2.0.0 27,204,829 8/11/2017 2.0.0 is deprecated because it is no longer maintained.
2.0.0-preview2-final 96,028 6/28/2017 2.0.0-preview2-final is deprecated because it is no longer maintained.
2.0.0-preview1-final 1,115,220 5/10/2017 2.0.0-preview1-final is deprecated because it is no longer maintained.
1.1.6 5,824,933 7/10/2018 1.1.6 is deprecated because it is no longer maintained.
1.1.5 1,246,184 12/12/2017 1.1.5 is deprecated because it is no longer maintained.
1.1.4 223,416 11/14/2017 1.1.4 is deprecated because it is no longer maintained.
1.1.3 307,990 9/20/2017 1.1.3 is deprecated because it is no longer maintained.
1.1.2 4,992,127 5/9/2017 1.1.2 is deprecated because it is no longer maintained.
1.1.1 3,172,345 3/6/2017 1.1.1 is deprecated because it is no longer maintained.
1.1.0 7,224,147 11/16/2016 1.1.0 is deprecated because it is no longer maintained.
1.1.0-preview1-final 46,516 10/24/2016 1.1.0-preview1-final is deprecated because it is no longer maintained.
1.0.6 54,614 11/14/2017 1.0.6 is deprecated because it is no longer maintained.
1.0.5 43,043 9/20/2017 1.0.5 is deprecated because it is no longer maintained.
1.0.4 57,728 5/9/2017 1.0.4 is deprecated because it is no longer maintained.
1.0.3 646,969 3/6/2017 1.0.3 is deprecated because it is no longer maintained.
1.0.2 78,317 12/12/2016 1.0.2 is deprecated because it is no longer maintained.
1.0.1 784,681 9/13/2016 1.0.1 is deprecated because it is no longer maintained.
1.0.0 1,727,052 6/27/2016 1.0.0 is deprecated because it is no longer maintained.
1.0.0-rc2-final 139,623 5/16/2016 1.0.0-rc2-final is deprecated because it is no longer maintained.