Entity Framework Core (EF Core) is a modern, cross-platform, open-source, extensible data access technology for .NET. It allows developers to work with databases using .NET objects, abstracting away the underlying database specifics. EF Core achieves this abstraction through providers.
Providers are NuGet packages that map EF Core's operations to the specific API of a particular database system. This page provides an overview of some of the most commonly used EF Core providers.
The official EF Core provider for Microsoft SQL Server. Offers robust integration with SQL Server features.
A lightweight EF Core provider for SQLite databases, perfect for development, testing, and embedded scenarios.
A high-performance EF Core provider for PostgreSQL, developed and maintained by the Npgsql team.
An EF Core provider for MySQL, offering good compatibility and performance.
The official EF Core provider for Oracle Database, enabling seamless integration with Oracle's powerful features.
When selecting an EF Core provider, consider the following:
To use a provider, you typically need to:
dotnet add package Microsoft.EntityFrameworkCore.SqlServer.DbContext class or its configuration, specify the provider to use and its connection string.Example configuration in Startup.cs (or equivalent):
// For SQL Server
services.AddDbContext<MyDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
// For PostgreSQL with Npgsql
services.AddDbContext<MyDbContext>(options =>
options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection")));