Microsoft.EntityFrameworkCore 9.0.0-preview.3.24172.4

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
This is a prerelease version of Microsoft.EntityFrameworkCore.

Requires NuGet 3.6 or higher.

dotnet add package Microsoft.EntityFrameworkCore --version 9.0.0-preview.3.24172.4
NuGet\Install-Package Microsoft.EntityFrameworkCore -Version 9.0.0-preview.3.24172.4
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.0-preview.3.24172.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.EntityFrameworkCore --version 9.0.0-preview.3.24172.4
#r "nuget: Microsoft.EntityFrameworkCore, 9.0.0-preview.3.24172.4"
#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.
// Install Microsoft.EntityFrameworkCore as a Cake Addin
#addin nuget:?package=Microsoft.EntityFrameworkCore&version=9.0.0-preview.3.24172.4&prerelease

// Install Microsoft.EntityFrameworkCore as a Cake Tool
#tool nuget:?package=Microsoft.EntityFrameworkCore&version=9.0.0-preview.3.24172.4&prerelease

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7.6K)

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

Package Downloads
Microsoft.EntityFrameworkCore.Relational The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Shared Entity Framework Core components for relational database providers.

Microsoft.EntityFrameworkCore.InMemory The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

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

Npgsql.EntityFrameworkCore.PostgreSQL The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

PostgreSQL/Npgsql provider for Entity Framework Core.

Microsoft.EntityFrameworkCore.Proxies The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Lazy loading proxies for Entity Framework Core.

Microsoft.AspNetCore.App The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

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 (546)

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

Repository Stars
jasontaylordev/CleanArchitecture
Clean Architecture Solution Template for ASP.NET Core
dotnet/AspNetCore.Docs
Documentation 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 and the ASP.NET Core platforms. Provides the fundamental infrastructure, production-ready startup templates, application modules, UI themes, tooling, guides and documentation.
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
9.0.0-preview.3.24172.4 34,329 4/11/2024
9.0.0-preview.2.24128.4 29,165 3/12/2024
9.0.0-preview.1.24081.2 50,924 2/13/2024
8.0.5 115,759 5/14/2024
8.0.4 2,629,958 4/9/2024
8.0.3 3,351,091 3/12/2024
8.0.2 5,441,717 2/13/2024
8.0.1 5,504,178 1/9/2024
8.0.0 10,235,717 11/14/2023
8.0.0-rc.2.23480.1 353,992 10/10/2023
8.0.0-rc.1.23419.6 118,204 9/12/2023
8.0.0-preview.7.23375.4 71,180 8/8/2023
8.0.0-preview.6.23329.4 115,689 7/11/2023
8.0.0-preview.5.23280.1 106,876 6/13/2023
8.0.0-preview.4.23259.3 103,555 5/16/2023
8.0.0-preview.3.23174.2 144,282 4/11/2023
8.0.0-preview.2.23128.3 160,721 3/14/2023
8.0.0-preview.1.23111.4 125,612 2/21/2023
7.0.19 13,762 5/14/2024
7.0.18 299,481 4/9/2024
7.0.17 581,604 3/12/2024
7.0.16 1,084,725 2/13/2024
7.0.15 1,763,764 1/9/2024
7.0.14 3,736,645 11/14/2023
7.0.13 4,182,738 10/24/2023
7.0.12 3,240,276 10/10/2023
7.0.11 8,849,885 9/12/2023
7.0.10 7,082,946 8/8/2023
7.0.9 6,226,142 7/11/2023
7.0.8 4,184,547 6/22/2023
7.0.7 2,981,566 6/13/2023
7.0.5 19,538,556 4/11/2023
7.0.4 7,778,097 3/14/2023
7.0.3 10,890,737 2/14/2023
7.0.2 14,254,434 1/10/2023
7.0.1 8,103,694 12/13/2022
7.0.0 19,189,974 11/7/2022
7.0.0-rc.2.22472.11 192,261 10/11/2022
7.0.0-rc.1.22426.7 200,915 9/14/2022
7.0.0-preview.7.22376.2 84,815 8/9/2022
7.0.0-preview.6.22329.4 63,707 7/12/2022
7.0.0-preview.5.22302.2 57,946 6/14/2022
7.0.0-preview.4.22229.2 70,978 5/10/2022
7.0.0-preview.3.22175.1 72,364 4/13/2022
7.0.0-preview.2.22153.1 82,484 3/14/2022
7.0.0-preview.1.22076.6 50,749 2/17/2022
6.0.30 16,361 5/14/2024
6.0.29 320,949 4/9/2024
6.0.28 446,870 3/12/2024
6.0.27 720,652 2/13/2024
6.0.26 1,319,104 1/9/2024
6.0.25 1,930,013 11/14/2023
6.0.24 1,128,802 10/24/2023
6.0.23 836,492 10/10/2023
6.0.22 2,117,535 9/12/2023
6.0.21 2,300,991 8/8/2023
6.0.20 1,984,421 7/11/2023
6.0.19 1,573,016 6/22/2023
6.0.18 942,025 6/13/2023
6.0.16 5,486,717 4/11/2023
6.0.15 3,216,870 3/14/2023
6.0.14 3,965,213 2/14/2023
6.0.13 5,466,599 1/10/2023
6.0.12 8,047,363 12/13/2022
6.0.11 8,003,700 11/7/2022
6.0.10 14,218,471 10/11/2022
6.0.9 12,717,956 9/13/2022
6.0.8 14,994,958 8/9/2022
6.0.7 39,445,339 7/12/2022
6.0.6 12,305,683 6/14/2022
6.0.5 18,777,133 5/10/2022
6.0.4 15,076,004 4/11/2022
6.0.3 19,738,559 3/8/2022
6.0.2 17,076,312 2/8/2022
6.0.1 27,589,403 12/14/2021
6.0.0 49,711,923 11/8/2021
6.0.0-rc.2.21480.5 301,850 10/12/2021
6.0.0-rc.1.21452.10 191,645 9/14/2021
6.0.0-preview.7.21378.4 87,516 8/10/2021
6.0.0-preview.6.21352.1 41,752 7/14/2021
6.0.0-preview.5.21301.9 172,771 6/15/2021
6.0.0-preview.4.21253.1 70,381 5/24/2021
6.0.0-preview.3.21201.2 90,413 4/8/2021
6.0.0-preview.2.21154.2 66,597 3/11/2021
6.0.0-preview.1.21102.2 90,635 2/12/2021
5.0.17 5,919,321 5/10/2022
5.0.16 1,322,452 4/11/2022
5.0.15 2,020,939 3/8/2022
5.0.14 2,193,707 2/8/2022
5.0.13 4,002,003 12/14/2021
5.0.12 4,418,959 11/7/2021
5.0.11 7,700,283 10/12/2021
5.0.10 12,183,194 9/14/2021
5.0.9 9,509,981 8/10/2021
5.0.8 8,643,696 7/13/2021
5.0.7 13,257,494 6/8/2021
5.0.6 7,660,632 5/11/2021
5.0.5 10,543,950 4/6/2021
5.0.4 7,768,051 3/9/2021
5.0.3 7,695,004 2/9/2021
5.0.2 9,997,839 1/12/2021
5.0.1 14,703,281 12/8/2020
5.0.0 23,532,595 11/9/2020
5.0.0-rc.2.20475.6 367,333 10/13/2020
5.0.0-rc.1.20451.13 313,795 9/14/2020
5.0.0-preview.8.20407.4 195,807 8/25/2020
5.0.0-preview.7.20365.15 111,174 7/21/2020
5.0.0-preview.6.20312.4 61,911 6/25/2020
5.0.0-preview.5.20278.2 46,475 6/10/2020
5.0.0-preview.4.20220.10 71,266 5/18/2020
5.0.0-preview.3.20181.2 91,210 4/23/2020
5.0.0-preview.2.20159.4 59,521 4/2/2020
5.0.0-preview.2.20120.8 44,992 3/16/2020
3.1.32 2,777,771 12/13/2022
3.1.31 604,748 11/8/2022
3.1.30 552,396 10/11/2022
3.1.29 816,656 9/13/2022
3.1.28 644,258 8/9/2022
3.1.27 615,459 7/12/2022
3.1.26 530,672 6/14/2022
3.1.25 933,302 5/10/2022
3.1.24 584,525 4/11/2022
3.1.23 936,722 3/8/2022
3.1.22 2,823,831 12/14/2021
3.1.21 2,278,559 11/7/2021
3.1.20 1,289,146 10/11/2021
3.1.19 2,224,880 9/14/2021
3.1.18 4,768,982 8/10/2021
3.1.17 1,717,986 7/13/2021
3.1.16 2,149,000 6/8/2021
3.1.15 2,507,020 5/11/2021
3.1.14 2,908,935 4/6/2021
3.1.13 4,207,116 3/9/2021
3.1.12 2,816,381 2/9/2021
3.1.11 5,078,196 1/12/2021
3.1.10 7,970,491 11/9/2020
3.1.9 11,407,092 10/13/2020
3.1.8 16,974,450 9/8/2020
3.1.7 9,308,228 8/11/2020
3.1.6 10,201,948 7/14/2020
3.1.5 12,080,397 6/9/2020
3.1.4 16,909,305 5/12/2020
3.1.3 26,102,383 3/24/2020
3.1.2 11,306,915 2/19/2020
3.1.1 18,830,900 1/14/2020
3.1.0 31,282,285 12/3/2019
3.1.0-preview3.19554.8 159,667 11/13/2019
3.1.0-preview2.19525.5 31,804 11/1/2019
3.1.0-preview1.19506.2 705,332 10/15/2019
3.0.3 174,024 2/19/2020
3.0.2 77,712 1/14/2020
3.0.1 1,340,083 11/18/2019
3.0.0 17,795,276 9/23/2019
3.0.0-rc1.19456.14 45,685 9/16/2019
3.0.0-preview9.19423.6 1,315,733 9/4/2019
3.0.0-preview8.19405.11 396,243 8/13/2019
3.0.0-preview7.19362.6 87,480 7/23/2019
3.0.0-preview6.19304.10 159,978 6/12/2019
3.0.0-preview5.19227.1 647,190 5/6/2019
3.0.0-preview4.19216.3 22,271 4/18/2019
3.0.0-preview3.19153.1 196,032 3/6/2019
3.0.0-preview.19074.3 30,203 1/29/2019
3.0.0-preview.18572.1 46,695 12/3/2018
2.2.6 29,907,701 7/9/2019
2.2.4 18,763,539 4/9/2019
2.2.3 5,185,534 3/11/2019
2.2.2 6,193,696 2/12/2019
2.2.1 6,655,303 1/8/2019
2.2.0 19,737,542 12/3/2018
2.2.0-preview3-35497 182,566 10/17/2018
2.2.0-preview2-35157 141,557 9/12/2018
2.2.0-preview1-35029 80,230 8/22/2018
2.1.14 3,642,798 11/18/2019
2.1.11 3,611,667 5/14/2019
2.1.8 3,486,455 2/12/2019
2.1.4 15,026,075 10/1/2018
2.1.3 4,780,763 9/11/2018
2.1.2 7,905,949 8/21/2018
2.1.1 14,149,279 6/18/2018
2.1.0 12,565,865 5/29/2018
2.1.0-rc1-final 215,027 5/6/2018
2.1.0-preview2-final 195,392 4/10/2018
2.1.0-preview1-final 308,651 2/26/2018
2.0.3 5,068,617 5/7/2018
2.0.2 6,367,894 3/13/2018
2.0.1 11,916,910 11/14/2017
2.0.0 24,791,527 8/11/2017
2.0.0-preview2-final 93,094 6/28/2017
2.0.0-preview1-final 1,063,979 5/10/2017
1.1.6 5,029,382 7/10/2018
1.1.5 1,202,176 12/12/2017
1.1.4 212,070 11/14/2017
1.1.3 300,078 9/20/2017
1.1.2 4,484,238 5/9/2017
1.1.1 2,843,268 3/6/2017
1.1.0 5,946,821 11/16/2016
1.1.0-preview1-final 45,554 10/24/2016
1.0.6 51,176 11/14/2017
1.0.5 40,779 9/20/2017
1.0.4 55,437 5/9/2017
1.0.3 568,451 3/6/2017
1.0.2 77,186 12/12/2016
1.0.1 641,942 9/13/2016
1.0.0 1,297,769 6/27/2016
1.0.0-rc2-final 130,725 5/16/2016