安装后,需采用 OnConfiguring 方法或 AddDbContext 方法(如果使用的是依赖关系注入容器)在 DbContext 中配置提供程序。 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. MariaDB - see CONFSERVER-29060; Percona Server - see CONFSERVER-36471; Confluence can become unresponsive with Oracle's Native Network Encryption - see CONFSERVER-60152 for mitigation options. Confluence requires Service Pack 1 or later for Microsoft SQL Server 2016 - see CONFSERVER-61145. VMware Workstation 15是一款最先进的虚拟化软件,中文名“威睿工作站”,提供用户可在单一的桌面上同时运行不同的操作系统,和进行开发、测试 、部署新的应用程序的最佳解决方案,这里整理了VMware Workstation Pro 15详细安装教程.
-->It features a responsive, single-page interface, a unified workspace, a smart and beautiful SQL editor and more. It currently supports Windows, Linux and OSX platforms, and the following DBMS: PostgreSQL, MariaDB, Oracle, MySQL, SQLite (WIP), Firebird (WIP), SQL Server (WIP), IBM DB2 (WIP).
Entity Framework Core 可通过名为数据库提供程序的插件库访问许多不同的数据库。Entity Framework Core can access many different databases through plug-in libraries called database providers.
当前提供程序Current providers
重要
EF Core 提供程序由多种源生成。EF Core providers are built by a variety of sources.并非所有提供程序均作为 Entity Framework Core 项目的组成部分进行维护。Not all providers are maintained as part of the 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.
重要
EF Core 提供程序通常跨次要版本工作,但不跨主要版本工作。EF Core providers typically work across minor versions, but not across major versions.例如,针对 EF Core 2.1 发布的提供程序应用于 EF Core 2.2,但不适用于 EF Core 3.0。For example, a provider released for EF Core 2.1 should work with EF Core 2.2, but will not work with EF Core 3.0.
NuGet 程序包NuGet Package | 支持的数据库引擎Supported database engines | 维护商/供应商Maintainer / Vendor | 备注/要求Notes / Requirements | 专为版本构建Built for version | 有用的链接Useful links |
---|---|---|---|---|---|
Microsoft.EntityFrameworkCore.SqlServerMicrosoft.EntityFrameworkCore.SqlServer | SQL Server 2012 以上版本SQL Server 2012 onwards | EF Core 项目 (Microsoft)EF Core Project (Microsoft) | 5.05.0 | docsdocs | |
Microsoft.EntityFrameworkCore.SqliteMicrosoft.EntityFrameworkCore.Sqlite | SQLite 3.7 及以上版本SQLite 3.7 onwards | EF Core 项目 (Microsoft)EF Core Project (Microsoft) | 5.05.0 | docsdocs | |
Microsoft.EntityFrameworkCore.InMemoryMicrosoft.EntityFrameworkCore.InMemory | EF Core 内存中数据库EF Core in-memory database | EF Core 项目 (Microsoft)EF Core Project (Microsoft) | 限制Limitations | 5.05.0 | docsdocs |
Microsoft.EntityFrameworkCore.CosmosMicrosoft.EntityFrameworkCore.Cosmos | Azure Cosmos DB SQL APIAzure Cosmos DB SQL API | EF Core 项目 (Microsoft)EF Core Project (Microsoft) | 5.05.0 | docsdocs | |
Npgsql.EntityFrameworkCore.PostgreSQLNpgsql.EntityFrameworkCore.PostgreSQL | postgresqlPostgreSQL | Npgsql 开发团队Npgsql Development Team | 5.05.0 | docsdocs | |
Pomelo.EntityFrameworkCore.MySqlPomelo.EntityFrameworkCore.MySql | MySQL、MariaDBMySQL, MariaDB | Pomelo Foundation 项目Pomelo Foundation Project | 3.13.1 | 自述文件readme | |
MySql.EntityFrameworkCoreMySql.EntityFrameworkCore | MySQLMySQL | MySQL 项目 (Oracle)MySQL project (Oracle) | 5.05.0 | docsdocs | |
Oracle.EntityFrameworkCoreOracle.EntityFrameworkCore | Oracle DB 11.2 及更高版本Oracle DB 11.2 onwards | OracleOracle | 5.05.0 | 网站website | |
Devart.Data.MySql.EFCoreDevart.Data.MySql.EFCore | MySQL 5 及以上版本MySQL 5 onwards | DevArtDevArt | 已付Paid | 3.13.1 | docsdocs |
Devart.Data.Oracle.EFCoreDevart.Data.Oracle.EFCore | Oracle DB 9.2.0.4 及更高版本Oracle DB 9.2.0.4 onwards | DevArtDevArt | 已付Paid | 3.13.1 | docsdocs |
Devart.Data.PostgreSql.EFCoreDevart.Data.PostgreSql.EFCore | PostgreSQL 8.0 及以上版本PostgreSQL 8.0 onwards | DevArtDevArt | 已付Paid | 3.13.1 | docsdocs |
Devart.Data.SQLite.EFCoreDevart.Data.SQLite.EFCore | SQLite 3 及以上版本SQLite 3 onwards | DevArtDevArt | 已付Paid | 3.13.1 | docsdocs |
FirebirdSql.EntityFrameworkCore.FirebirdFirebirdSql.EntityFrameworkCore.Firebird | Firebird 2.5 和 3.xFirebird 2.5 and 3.x | Jiří ČinčuraJiří Činčura | 3.13.1 | docsdocs | |
IBM.EntityFrameworkCoreIBM.EntityFrameworkCore | Db2、InformixDb2, Informix | IBMIBM | 付费,WindowsPaid, Windows | 3.13.1 | 客户网站customer website |
IBM.EntityFrameworkCore-lnxIBM.EntityFrameworkCore-lnx | Db2、InformixDb2, Informix | IBMIBM | 付费,LinuxPaid, Linux | 3.13.1 | 客户网站customer website |
IBM.EntityFrameworkCore-osxIBM.EntityFrameworkCore-osx | Db2、InformixDb2, Informix | IBMIBM | 付费,macOSPaid, macOS | 3.13.1 | 客户网站customer website |
Teradata.EntityFrameworkCoreTeradata.EntityFrameworkCore | Teradata 数据库 16.10 及更高版本Teradata Database 16.10 onwards | TeradataTeradata | 3.13.1 | 网站website | |
FileContextCoreFileContextCore | 在文件中存储数据Stores data in files | Morris JanatzekMorris Janatzek | 用于开发For development purposes | 3.03.0 | 自述文件readme |
EntityFrameworkCore.JetEntityFrameworkCore.Jet | Microsoft Access 文件Microsoft Access files | BubiBubi | .NET Framework.NET Framework | 2.22.2 | 自述文件readme |
EntityFrameworkCore.SqlServerCompact35EntityFrameworkCore.SqlServerCompact35 | SQL Server Compact 3.5SQL Server Compact 3.5 | Erik Ejlskov JensenErik Ejlskov Jensen | .NET Framework.NET Framework | 2.22.2 | wikiwiki |
EntityFrameworkCore.SqlServerCompact40EntityFrameworkCore.SqlServerCompact40 | SQL Server Compact 4.0SQL Server Compact 4.0 | Erik Ejlskov JensenErik Ejlskov Jensen | .NET Framework.NET Framework | 2.22.2 | wikiwiki |
EntityFrameworkCore.FirebirdSqlEntityFrameworkCore.FirebirdSql | Firebird 2.5 和 3.xFirebird 2.5 and 3.x | Rafael AlmeidaRafael Almeida | 2.12.1 | wikiwiki | |
EntityFrameworkCore.OpenEdgeEntityFrameworkCore.OpenEdge | Progress OpenEdgeProgress OpenEdge | Alex WieseAlex Wiese | 2.12.1 | 自述文件readme |
向应用程序添加数据库提供程序Adding a database provider to your application
EF Core 的大多数数据库提供程序都是作为 NuGet 包分发的,可按如下所示安装:Most database providers for EF Core are distributed as NuGet packages, and can be installed as follows:
安装后,需采用 OnConfiguring
方法或 AddDbContext
方法(如果使用的是依赖关系注入容器)在 DbContext
中配置提供程序。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.例如,以下行使用传递的连接字符串配置 SQL Server 提供程序:For example, the following line configures the SQL Server provider with the passed connection string:
数据库提供程序可扩展 EF Core,启用特定数据库特有的功能。Database providers can extend EF Core to enable functionality unique to specific databases.一些概念为大多数据库共有,它们包含于 EF Core 主要组件中。Some concepts are common to most databases, and are included in the primary EF Core components.此类概念包括 LINQ 中的表达查询、事务以及对象从数据库加载后的跟踪更改。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.例如,通过 SQL Server 提供程序可配置内存优化表(SQL Server 的一种特定功能)。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.例如,用于关系数据库的 EF Core 提供程序构建于公共 Microsoft.EntityFrameworkCore.Relational
库上,该库提供的 API 可用于配置表和列映射、外键约束等。提供程序通常作为 NuGet 包分发。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.
Mariadb Osx Stop
重要
Mariadb Exec
发布 EF Core 的新补丁版本时,其中通常包含 Microsoft.EntityFrameworkCore.Relational
包的更新。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.但许多提供程序是独立于 EF Core 发布的,因此可能不会更新为依赖该包的较新补丁版本。But many providers are released independently from EF Core and may not be updated to depend on the newer patch version of that package.为确保能修复所有 bug,建议将 Microsoft.EntityFrameworkCore.Relational
补丁版本添加为应用程序的直接依赖项。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.