語言

SqlServerDbContextOptionsBuilder.UseCompatibilityLevel(Int32) 方法

定義

設定 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 相容性文件。

適用於