SqlServerDbContextOptionsBuilder.UseCompatibilityLevel(Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
设置 EF Core 在与数据库交互时将使用的SQL Server兼容级别。 这允许将 EF Core 配置为使用较旧的(或更新)版本的SQL Server。 默认值为 160 (SQL Server 2022)。
public virtual Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder UseCompatibilityLevel(int compatibilityLevel);
abstract member UseCompatibilityLevel : int -> Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder
override this.UseCompatibilityLevel : int -> Microsoft.EntityFrameworkCore.Infrastructure.SqlServerDbContextOptionsBuilder
Public Overridable Function UseCompatibilityLevel (compatibilityLevel As Integer) As SqlServerDbContextOptionsBuilder
参数
- compatibilityLevel
- Int32
要用于数据库的兼容级别。
返回
注解
有关详细信息和示例,请参阅有关兼容级别的使用 DbContextOptions 和SQL Server文档。