Back to Entityframework

Database Providers - EF Core

entity-framework/core/providers/index.md

latest27.8 KB
Original Source

Database Providers

Entity Framework Core can access many different databases through plug-in libraries called database providers.

Current providers

[!IMPORTANT] EF Core providers are built by a variety of sources. Not all providers are maintained as part of the Microsoft Entity Framework Core Project. When considering a provider, be sure to evaluate quality, licensing, support, etc. to ensure they meet your requirements. Also make sure you review each provider's documentation for detailed version compatibility information.

[!IMPORTANT] EF Core providers typically do not work across major versions. For example, a provider released for EF Core 8 will not work with EF Core 9.

NuGet PackageSupported database enginesMaintainer / VendorNotes / RequirementsFor EF CoreUseful links
Microsoft.EntityFrameworkCore.SqlServerAzure SQL, SQL Server 2012 onwards, Azure Synapse AnalyticsEF Core Project (Microsoft)8, 9, 10docs
Microsoft.EntityFrameworkCore.SqliteSQLite 3.46.1 onwardsEF Core Project (Microsoft)8, 9, 10docs
Microsoft.EntityFrameworkCore.InMemoryEF Core in-memory databaseEF Core Project (Microsoft)Limitations8, 9, 10docs
Microsoft.EntityFrameworkCore.CosmosAzure Cosmos DB SQL APIEF Core Project (Microsoft)8, 9, 10docs
Npgsql.EntityFrameworkCore.PostgreSQLPostgreSQLNpgsql Development Team8, 9docs
Pomelo.EntityFrameworkCore.MySqlMySQL, MariaDBPomelo Foundation Project8, 9readme
MySql.EntityFrameworkCoreMySQLMySQL project (Oracle)8, 9docs
Oracle.EntityFrameworkCoreOracle DB 19c onwardsOracle8, 9, 10docs
MongoDB.EntityFrameworkCoreMongoDBMongoDB8docs
Couchbase.EntityFrameworkCoreCouchbaseCouchbase8, 9docs
Devart.Data.MySql.EFCoreMySQL 5 onwardsDevArtPaid8, 9docs
Devart.Data.Oracle.EFCoreOracle DB 9.2.0.4 onwardsDevArtPaid8, 9docs
Devart.Data.PostgreSql.EFCorePostgreSQL 8.0 onwardsDevArtPaid8, 9docs
Devart.Data.SQLite.EFCoreSQLite 3 onwardsDevArtPaid8, 9docs
Devart.Data.DB2.EFCoreDB2DevArtPaid8, 9docs
Devart.Data.Bigcommerce.EFCoreBigCommerceDevArtPaid8, 9docs
Devart.Data.Dynamics.EFCoreMicrosoft Dynamics 365DevArtPaid8, 9docs
Devart.Data.FreshBooks.EFCoreFreshBooksDevArtPaid8, 9docs
Devart.Data.Magento.EFCoreMagentoDevArtPaid8, 9docs
Devart.Data.MailChimp.EFCoreMailchimpDevArtPaid8, 9docs
Devart.Data.QuickBooks.EFCoreQuickBooksDevArtPaid8, 9docs
Devart.Data.Salesforce.EFCoreSalesforceDevArtPaid8, 9docs
Devart.Data.ExactTarget.EFCoreSalesforce MC (ExactTarget)DevArtPaid8, 9docs
Devart.Data.Sugar.EFCoreSugarCRMDevArtPaid8, 9docs
Devart.Data.Zoho.EFCoreZoho CRMDevArtPaid8, 9docs
Devart.Data.ZohoBooks.EFCoreZoho BooksDevArtPaid8, 9docs
Devart.Data.ZohoDesk.EFCoreZoho DeskDevArtPaid8, 9docs
MASES.EntityFrameworkCore.KNetApache KafkaMASES GroupTrial, Subscription8docs
InterBaseInterBaseInterBase8docs
FirebirdSql.EntityFrameworkCore.FirebirdFirebird 3.0 onwardsJiří Činčura8docs
IBM.EntityFrameworkCoreDb2, InformixIBMPaid, Windows8getting started
IBM.EntityFrameworkCore-lnxDb2, InformixIBMPaid, Linux8getting started
IBM.EntityFrameworkCore-osxDb2, InformixIBMPaid, macOS8getting started
EntityFrameworkCore.JetMicrosoft Access filesCirrusRedOrgWindows8, 9readme
Google.Cloud.EntityFrameworkCore.SpannerGoogle Cloud SpannerCloud Spanner Ecosystem8tutorial
Teradata.EntityFrameworkCoreTeradata Database 16.10 onwardsTeradata3website
FileContextCoreStores data in filesMorris JanatzekFor development purposes3readme
FileBaseContextStore tables in filesk.D.gFor development purposes8, 9, 10readme
EntityFrameworkCore.SqlServerCompact35SQL Server Compact 3.5Erik Ejlskov Jensen.NET Framework2wiki
EntityFrameworkCore.SqlServerCompact40SQL Server Compact 4.0Erik Ejlskov Jensen.NET Framework2wiki
EntityFrameworkCore.OpenEdgeProgress OpenEdgeAlex Wiese2readme
EFCore.SnowflakeSnowflakeKrzysztof Sielaff8readme
EFCore.KustoAzure Data Explorer (Kusto)Anas Ismail Khan8readme
EntityFrameworkCore.YdbYDBYDB Team9, 10website

Adding a database provider to your application

Most database providers for EF Core are distributed as NuGet packages, and can be installed as follows:

.NET CLI

dotnetcli
dotnet add package provider_package_name

Visual Studio

powershell
install-package provider_package_name

Once installed, you will configure the provider in your DbContext, either in the OnConfiguring method or in the AddDbContext method if you are using a dependency injection container. For example, the following line configures the SQL Server provider with the passed connection string:

csharp
optionsBuilder.UseSqlServer(
    @"Server=(localdb)\mssqllocaldb;Database=MyDatabase;Trusted_Connection=True;");

Database providers can extend EF Core to enable functionality unique to specific databases. Some concepts are common to most databases, and are included in the primary EF Core components. Such concepts include expressing queries in LINQ, transactions, and tracking changes to objects once they are loaded from the database. Some concepts are specific to a particular provider. For example, the SQL Server provider allows you to configure memory-optimized tables (a feature specific to SQL Server). Other concepts are specific to a class of providers. For example, EF Core providers for relational databases build on the common Microsoft.EntityFrameworkCore.Relational library, which provides APIs for configuring table and column mappings, foreign key constraints, etc. Providers are usually distributed as NuGet packages.

[!IMPORTANT] When a new patch version of EF Core is released, it often includes updates to the Microsoft.EntityFrameworkCore.Relational package. When you add a relational database provider, this package becomes a transitive dependency of your application. But many providers are released independently from EF Core and may not be updated to depend on the newer patch version of that package. In order to make sure you will get all bug fixes, it is recommended that you add the patch version of Microsoft.EntityFrameworkCore.Relational as a direct dependency of your application.