Microsoft.EntityFrameworkCore 10.0.0-preview.3.25171.6 (original) (raw)

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 net10.0 is compatible.

NuGet packages (8.9K)

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. 1.4B
Microsoft.EntityFrameworkCore.InMemory In-memory database provider for Entity Framework Core (to be used for testing purposes). 291.9M
Npgsql.EntityFrameworkCore.PostgreSQL PostgreSQL/Npgsql provider for Entity Framework Core. 249.3M
Microsoft.EntityFrameworkCore.Proxies Lazy loading proxies for Entity Framework Core. 73.7M
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. 38.2M

GitHub repositories (629)

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

Repository Stars
jasontaylordev/CleanArchitecture Clean Architecture Solution Template for ASP.NET Core 18.0K
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. 13.4K
dotnet/AspNetCore.Docs Documentation for ASP.NET Core 12.9K
kgrzybek/modular-monolith-with-ddd Full Modular Monolith application with Domain-Driven Design approach. 12.0K
aspnetboilerplate/aspnetboilerplate ASP.NET Boilerplate - Web Application Framework 11.9K
dodyg/practical-aspnetcore Practical samples of ASP.NET Core 10 Preview 3, 9, 8.0, 7.0, 6.0, 5.0, 3.1, 2.2, and 2.1,projects you can use. Readme contains explanations on all projects. 9.9K
davidfowl/AspNetCoreDiagnosticScenarios This repository has examples of broken patterns in ASP.NET Core applications 8.4K
elsa-workflows/elsa-core A .NET workflows library 7.0K
louthy/language-ext C# pure functional programming framework - come and get declarative! 6.8K
btcpayserver/btcpayserver Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor. 6.7K
EduardoPires/EquinoxProject Web Application ASP.NET 9 using Clean Architecture, DDD, CQRS, Event Sourcing and a lot of good practices 6.6K
graphql-dotnet/graphql-dotnet GraphQL for .NET 5.9K
ldqk/Masuit.Tools 全龄段友好的C#万能工具库,码数吐司库,包含一些常用的操作类,大都是静态类,加密解密,反射操作,权重随机筛选算法,分布式短id,表达式树,linq扩展,文件压缩,多线程下载,硬件信息,字符串扩展方法,日期时间扩展操作,中国农历,大文件拷贝,图像裁剪,验证码,断点续传,集合扩展、Excel导出等常用封装。诸多功能集一身,代码量不到2MB! 5.8K
fullstackhero/dotnet-starter-kit Production Grade Cloud-Ready .NET 9 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included. 5.6K
danielgerlag/workflow-core Lightweight workflow engine for .NET Standard 5.6K
ChilliCream/graphql-platform Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Nitro the awesome Monaco based GraphQL IDE. 5.4K
jasontaylordev/NorthwindTraders Northwind Traders is a sample application built using ASP.NET Core and Entity Framework Core. 5.0K
immense/Remotely A remote control and remote scripting solution, built with .NET 8, Blazor, and SignalR. 4.8K
dotnetcore/Util Util是一个.Net平台下的应用框架,旨在提升中小团队的开发能力,由工具类、分层架构基类、Ui组件,配套代码生成模板,权限等组成。 4.6K
MapsterMapper/Mapster A fast, fun and stimulating object to object Mapper 4.6K
Version Downloads Last updated
10.0.0-preview.3.25171.6 9,353 4/10/2025
10.0.0-preview.2.25163.8 11,195 3/18/2025
10.0.0-preview.1.25081.1 11,805 2/25/2025
9.0.4 1,719,295 4/8/2025
9.0.3 4,172,981 3/11/2025
9.0.2 4,444,813 2/11/2025
9.0.1 6,790,531 1/14/2025
9.0.0 12,012,798 11/12/2024
9.0.0-rc.2.24474.1 199,141 10/8/2024
9.0.0-rc.1.24451.1 126,594 9/10/2024
9.0.0-preview.7.24405.3 83,554 8/13/2024
9.0.0-preview.6.24327.4 131,733 7/9/2024
9.0.0-preview.5.24306.3 45,799 6/11/2024
9.0.0-preview.4.24267.1 59,437 5/21/2024
9.0.0-preview.3.24172.4 174,016 4/11/2024
9.0.0-preview.2.24128.4 70,096 3/12/2024
9.0.0-preview.1.24081.2 108,222 2/13/2024
8.0.15 552,825 4/8/2025
8.0.14 1,684,023 3/11/2025
8.0.13 2,577,175 2/11/2025
8.0.12 3,051,044 1/14/2025
8.0.11 13,346,816 11/12/2024
8.0.10 18,120,736 10/8/2024
8.0.8 22,979,781 8/13/2024
8.0.7 14,543,517 7/9/2024
8.0.6 16,713,230 5/28/2024
8.0.5 7,202,872 5/14/2024
8.0.4 26,600,692 4/9/2024
8.0.3 11,154,690 3/12/2024
8.0.2 21,836,963 2/13/2024
8.0.1 14,190,693 1/9/2024
8.0.0 41,882,560 11/14/2023
8.0.0-rc.2.23480.1 523,890 10/10/2023
8.0.0-rc.1.23419.6 145,505 9/12/2023
8.0.0-preview.7.23375.4 115,511 8/8/2023
8.0.0-preview.6.23329.4 199,014 7/11/2023
8.0.0-preview.5.23280.1 178,919 6/13/2023
8.0.0-preview.4.23259.3 136,524 5/16/2023
8.0.0-preview.3.23174.2 229,863 4/11/2023
8.0.0-preview.2.23128.3 196,036 3/14/2023
8.0.0-preview.1.23111.4 139,328 2/21/2023
7.0.20 3,284,302 5/28/2024
7.0.19 511,041 5/14/2024
7.0.18 2,240,052 4/9/2024
7.0.17 1,601,977 3/12/2024
7.0.16 2,045,933 2/13/2024
7.0.15 3,189,598 1/9/2024
7.0.14 6,033,197 11/14/2023
7.0.13 6,692,946 10/24/2023
7.0.12 4,398,754 10/10/2023
7.0.11 13,493,353 9/12/2023
7.0.10 9,618,550 8/8/2023
7.0.9 8,990,078 7/11/2023
7.0.8 5,476,855 6/22/2023
7.0.7 3,757,330 6/13/2023
7.0.5 25,506,462 4/11/2023
7.0.4 9,386,078 3/14/2023
7.0.3 13,728,824 2/14/2023
7.0.2 18,661,874 1/10/2023
7.0.1 10,000,108 12/13/2022
7.0.0 29,969,276 11/7/2022
7.0.0-rc.2.22472.11 221,267 10/11/2022
7.0.0-rc.1.22426.7 214,266 9/14/2022
7.0.0-preview.7.22376.2 98,151 8/9/2022
7.0.0-preview.6.22329.4 77,006 7/12/2022
7.0.0-preview.5.22302.2 65,077 6/14/2022
7.0.0-preview.4.22229.2 84,867 5/10/2022
7.0.0-preview.3.22175.1 78,930 4/13/2022
7.0.0-preview.2.22153.1 86,129 3/14/2022
7.0.0-preview.1.22076.6 58,410 2/17/2022
6.0.36 1,082,652 11/12/2024
6.0.35 611,635 10/8/2024
6.0.33 1,640,955 8/13/2024
6.0.32 755,000 7/9/2024
6.0.31 1,041,376 5/28/2024
6.0.30 556,495 5/14/2024
6.0.29 2,623,437 4/9/2024
6.0.28 1,531,896 3/12/2024
6.0.27 1,826,217 2/13/2024
6.0.26 2,597,379 1/9/2024
6.0.25 3,588,189 11/14/2023
6.0.24 1,867,705 10/24/2023
6.0.23 1,229,466 10/10/2023
6.0.22 3,343,471 9/12/2023
6.0.21 3,551,004 8/8/2023
6.0.20 2,849,565 7/11/2023
6.0.19 2,389,028 6/22/2023
6.0.18 1,271,459 6/13/2023
6.0.16 7,511,176 4/11/2023
6.0.15 4,152,088 3/14/2023
6.0.14 5,258,731 2/14/2023
6.0.13 6,900,122 1/10/2023
6.0.12 10,767,499 12/13/2022
6.0.11 9,862,891 11/7/2022
6.0.10 17,408,150 10/11/2022
6.0.9 15,218,401 9/13/2022
6.0.8 18,315,896 8/9/2022
6.0.7 49,473,989 7/12/2022
6.0.6 14,706,119 6/14/2022
6.0.5 22,420,302 5/10/2022
6.0.4 17,847,882 4/11/2022
6.0.3 24,576,064 3/8/2022
6.0.2 19,710,822 2/8/2022
6.0.1 32,690,625 12/14/2021
6.0.0 68,515,710 11/8/2021
6.0.0-rc.2.21480.5 325,283 10/12/2021
6.0.0-rc.1.21452.10 266,804 9/14/2021
6.0.0-preview.7.21378.4 97,976 8/10/2021
6.0.0-preview.6.21352.1 43,858 7/14/2021
6.0.0-preview.5.21301.9 187,840 6/15/2021
6.0.0-preview.4.21253.1 72,875 5/24/2021
6.0.0-preview.3.21201.2 97,285 4/8/2021
6.0.0-preview.2.21154.2 73,094 3/11/2021
6.0.0-preview.1.21102.2 96,257 2/12/2021
5.0.17 7,702,905 5/10/2022 5.0.17 is deprecated because it is no longer maintained.
5.0.16 1,499,911 4/11/2022 5.0.16 is deprecated because it is no longer maintained.
5.0.15 2,342,340 3/8/2022 5.0.15 is deprecated because it is no longer maintained.
5.0.14 2,362,388 2/8/2022 5.0.14 is deprecated because it is no longer maintained.
5.0.13 4,463,003 12/14/2021 5.0.13 is deprecated because it is no longer maintained.
5.0.12 4,843,675 11/7/2021 5.0.12 is deprecated because it is no longer maintained.
5.0.11 8,419,748 10/12/2021 5.0.11 is deprecated because it is no longer maintained.
5.0.10 13,451,187 9/14/2021 5.0.10 is deprecated because it is no longer maintained.
5.0.9 10,328,679 8/10/2021 5.0.9 is deprecated because it is no longer maintained.
5.0.8 9,635,437 7/13/2021 5.0.8 is deprecated because it is no longer maintained.
5.0.7 14,426,655 6/8/2021 5.0.7 is deprecated because it is no longer maintained.
5.0.6 8,209,130 5/11/2021 5.0.6 is deprecated because it is no longer maintained.
5.0.5 11,448,419 4/6/2021 5.0.5 is deprecated because it is no longer maintained.
5.0.4 8,298,456 3/9/2021 5.0.4 is deprecated because it is no longer maintained.
5.0.3 8,086,553 2/9/2021 5.0.3 is deprecated because it is no longer maintained.
5.0.2 10,537,686 1/12/2021 5.0.2 is deprecated because it is no longer maintained.
5.0.1 15,983,536 12/8/2020 5.0.1 is deprecated because it is no longer maintained.
5.0.0 26,774,741 11/9/2020 5.0.0 is deprecated because it is no longer maintained.
5.0.0-rc.2.20475.6 380,943 10/13/2020
5.0.0-rc.1.20451.13 319,035 9/14/2020
5.0.0-preview.8.20407.4 203,157 8/25/2020
5.0.0-preview.7.20365.15 115,111 7/21/2020
5.0.0-preview.6.20312.4 63,997 6/25/2020
5.0.0-preview.5.20278.2 49,815 6/10/2020
5.0.0-preview.4.20220.10 73,948 5/18/2020
5.0.0-preview.3.20181.2 94,823 4/23/2020
5.0.0-preview.2.20159.4 61,797 4/2/2020
5.0.0-preview.2.20120.8 46,141 3/16/2020
3.1.32 5,819,228 12/13/2022
3.1.31 1,134,377 11/8/2022
3.1.30 749,514 10/11/2022
3.1.29 1,301,427 9/13/2022
3.1.28 858,035 8/9/2022
3.1.27 752,210 7/12/2022
3.1.26 659,898 6/14/2022
3.1.25 1,098,862 5/10/2022
3.1.24 660,484 4/11/2022
3.1.23 1,075,520 3/8/2022
3.1.22 3,474,300 12/14/2021
3.1.21 2,650,296 11/7/2021
3.1.20 1,591,826 10/11/2021
3.1.19 2,487,731 9/14/2021
3.1.18 5,344,044 8/10/2021
3.1.17 1,906,129 7/13/2021
3.1.16 2,399,684 6/8/2021
3.1.15 2,868,213 5/11/2021
3.1.14 3,133,439 4/6/2021
3.1.13 4,643,437 3/9/2021
3.1.12 3,024,190 2/9/2021
3.1.11 5,484,847 1/12/2021
3.1.10 8,378,121 11/9/2020
3.1.9 12,094,966 10/13/2020
3.1.8 17,772,751 9/8/2020
3.1.7 10,144,928 8/11/2020
3.1.6 10,848,818 7/14/2020
3.1.5 12,910,306 6/9/2020
3.1.4 18,028,638 5/12/2020
3.1.3 28,135,343 3/24/2020
3.1.2 11,978,352 2/19/2020
3.1.1 20,113,490 1/14/2020
3.1.0 34,475,237 12/3/2019
3.1.0-preview3.19554.8 164,889 11/13/2019
3.1.0-preview2.19525.5 32,770 11/1/2019
3.1.0-preview1.19506.2 764,199 10/15/2019
3.0.3 190,647 2/19/2020
3.0.2 80,375 1/14/2020
3.0.1 1,408,507 11/18/2019
3.0.0 19,139,724 9/23/2019
3.0.0-rc1.19456.14 46,787 9/16/2019
3.0.0-preview9.19423.6 1,383,635 9/4/2019
3.0.0-preview8.19405.11 412,764 8/13/2019
3.0.0-preview7.19362.6 90,850 7/23/2019
3.0.0-preview6.19304.10 168,204 6/12/2019
3.0.0-preview5.19227.1 671,868 5/6/2019
3.0.0-preview4.19216.3 23,070 4/18/2019
3.0.0-preview3.19153.1 202,489 3/6/2019
3.0.0-preview.19074.3 31,766 1/29/2019
3.0.0-preview.18572.1 48,687 12/3/2018
2.3.0 12,941 1/14/2025
2.2.6 31,853,928 7/9/2019 2.2.6 is deprecated because it is no longer maintained.
2.2.4 19,582,438 4/9/2019 2.2.4 is deprecated because it is no longer maintained.
2.2.3 5,349,373 3/11/2019 2.2.3 is deprecated because it is no longer maintained.
2.2.2 6,447,268 2/12/2019 2.2.2 is deprecated because it is no longer maintained.
2.2.1 6,903,762 1/8/2019 2.2.1 is deprecated because it is no longer maintained.
2.2.0 21,814,673 12/3/2018 2.2.0 is deprecated because it is no longer maintained.
2.2.0-preview3-35497 184,954 10/17/2018
2.2.0-preview2-35157 149,534 9/12/2018
2.2.0-preview1-35029 82,637 8/22/2018
2.1.14 3,988,456 11/18/2019
2.1.11 3,703,957 5/14/2019
2.1.8 3,775,123 2/12/2019
2.1.4 15,576,528 10/1/2018
2.1.3 4,898,217 9/11/2018
2.1.2 8,117,261 8/21/2018
2.1.1 16,485,619 6/18/2018
2.1.0 13,301,962 5/29/2018
2.1.0-rc1-final 224,456 5/6/2018
2.1.0-preview2-final 205,564 4/10/2018
2.1.0-preview1-final 317,205 2/26/2018
2.0.3 5,357,018 5/7/2018 2.0.3 is deprecated because it is no longer maintained.
2.0.2 6,691,256 3/13/2018 2.0.2 is deprecated because it is no longer maintained.
2.0.1 12,549,856 11/14/2017 2.0.1 is deprecated because it is no longer maintained.
2.0.0 27,384,935 8/11/2017 2.0.0 is deprecated because it is no longer maintained.
2.0.0-preview2-final 96,266 6/28/2017 2.0.0-preview2-final is deprecated because it is no longer maintained.
2.0.0-preview1-final 1,121,749 5/10/2017 2.0.0-preview1-final is deprecated because it is no longer maintained.
1.1.6 5,903,748 7/10/2018 1.1.6 is deprecated because it is no longer maintained.
1.1.5 1,249,589 12/12/2017 1.1.5 is deprecated because it is no longer maintained.
1.1.4 224,991 11/14/2017 1.1.4 is deprecated because it is no longer maintained.
1.1.3 308,559 9/20/2017 1.1.3 is deprecated because it is no longer maintained.
1.1.2 5,034,731 5/9/2017 1.1.2 is deprecated because it is no longer maintained.
1.1.1 3,203,321 3/6/2017 1.1.1 is deprecated because it is no longer maintained.
1.1.0 7,381,662 11/16/2016 1.1.0 is deprecated because it is no longer maintained.
1.1.0-preview1-final 46,572 10/24/2016 1.1.0-preview1-final is deprecated because it is no longer maintained.
1.0.6 54,937 11/14/2017 1.0.6 is deprecated because it is no longer maintained.
1.0.5 43,318 9/20/2017 1.0.5 is deprecated because it is no longer maintained.
1.0.4 58,004 5/9/2017 1.0.4 is deprecated because it is no longer maintained.
1.0.3 658,878 3/6/2017 1.0.3 is deprecated because it is no longer maintained.
1.0.2 78,442 12/12/2016 1.0.2 is deprecated because it is no longer maintained.
1.0.1 800,684 9/13/2016 1.0.1 is deprecated because it is no longer maintained.
1.0.0 1,796,459 6/27/2016 1.0.0 is deprecated because it is no longer maintained.
1.0.0-rc2-final 141,314 5/16/2016 1.0.0-rc2-final is deprecated because it is no longer maintained.