Microsoft.EntityFrameworkCore
3.0.0-preview.19074.3
Prefix Reserved
Requires NuGet 3.6 or higher.
dotnet add package Microsoft.EntityFrameworkCore --version 3.0.0-preview.19074.3
NuGet\Install-Package Microsoft.EntityFrameworkCore -Version 3.0.0-preview.19074.3
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0-preview.19074.3" />
paket add Microsoft.EntityFrameworkCore --version 3.0.0-preview.19074.3
#r "nuget: Microsoft.EntityFrameworkCore, 3.0.0-preview.19074.3"
// Install Microsoft.EntityFrameworkCore as a Cake Addin #addin nuget:?package=Microsoft.EntityFrameworkCore&version=3.0.0-preview.19074.3&prerelease // Install Microsoft.EntityFrameworkCore as a Cake Tool #tool nuget:?package=Microsoft.EntityFrameworkCore&version=3.0.0-preview.19074.3&prerelease
Entity Framework (EF) Core s a .NET library that provides an object-relational mapping (ORM) framework for .NET developers to work with databases. It supports multiple database providers, including SQL Server, MySQL, PostgreSQL, SQLite, and others.
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 context. 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 optionsBuilder)
{
optionsBuilder.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
- Getting Started with Entity Framework Core.
- Follow the ASP.NET Core Tutorial to use EF Core in a web app.
- Releases and planning(roadmap)
- How to write an EF Core provider
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.EntityFrameworkCore.Abstractions (>= 3.0.0-preview.19074.3)
- Microsoft.EntityFrameworkCore.Analyzers (>= 3.0.0-preview.19074.3)
- Microsoft.Extensions.Caching.Memory (>= 3.0.0-preview.19074.2)
- Microsoft.Extensions.DependencyInjection (>= 3.0.0-preview.19074.2)
- Microsoft.Extensions.Logging (>= 3.0.0-preview.19074.2)
- Remotion.Linq (>= 2.2.0)
- System.Collections.Immutable (>= 1.6.0-preview.19073.11)
- System.ComponentModel.Annotations (>= 4.6.0-preview.19073.11)
- System.Diagnostics.DiagnosticSource (>= 4.6.0-preview.19073.11)
- System.Interactive.Async (>= 3.2.0)
GitHub repositories (591)
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 |
---|---|---|
3.0.0-preview.19074.3 | 7 | 1/28/2019 |
3.0.0-preview.18572.1 | 3 | 11/30/2018 |