.NET Entity Framework Core Providers

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.

Official & Community Providers

Microsoft.EntityFrameworkCore.SqlServer

The official EF Core provider for Microsoft SQL Server. Offers robust integration with SQL Server features.

SQL Server Microsoft Official

Microsoft.EntityFrameworkCore.Sqlite

A lightweight EF Core provider for SQLite databases, perfect for development, testing, and embedded scenarios.

SQLite Microsoft Official Lightweight

Npgsql.EntityFrameworkCore.PostgreSQL

A high-performance EF Core provider for PostgreSQL, developed and maintained by the Npgsql team.

PostgreSQL Community High Performance

MySql.EntityFrameworkCore

An EF Core provider for MySQL, offering good compatibility and performance.

MySQL Community

Oracle.EntityFrameworkCore

The official EF Core provider for Oracle Database, enabling seamless integration with Oracle's powerful features.

Oracle Microsoft Official

Microsoft.EntityFrameworkCore.Cosmos

EF Core provider for Azure Cosmos DB, a globally distributed, multi-model NoSQL database service.

Cosmos DB NoSQL Microsoft Official

How to Choose a Provider

When selecting an EF Core provider, consider the following:

Getting Started with a Provider

To use a provider, you typically need to:

  1. Install the NuGet package: For example, dotnet add package Microsoft.EntityFrameworkCore.SqlServer.
  2. Configure the DbContext: In your 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")));