共用方式為


MigrationBuilder.AddCheckConstraint(String, String, String, String) 方法

定義

建置 , AddCheckConstraintOperation 以將新的檢查條件約束新增至資料表。

public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddCheckConstraintOperation> AddCheckConstraint (string name, string table, string sql, string schema = default);
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddCheckConstraintOperation> AddCheckConstraint (string name, string table, string sql, string? schema = default);
abstract member AddCheckConstraint : string * string * string * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddCheckConstraintOperation>
override this.AddCheckConstraint : string * string * string * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddCheckConstraintOperation>
Public Overridable Function AddCheckConstraint (name As String, table As String, sql As String, Optional schema As String = Nothing) As OperationBuilder(Of AddCheckConstraintOperation)

參數

name
String

檢查條件約束名稱。

table
String

檢查條件約束的資料表名稱。

sql
String

檢查條件約束的條件約束 sql。

schema
String

包含檢查條件約束的架構,或使用 null 預設架構。

傳回

建置器,允許將批註新增至作業。

備註

如需詳細資訊和範例 ,請參閱資料庫移 轉。

適用於