共用方式為


CreateTableBuilder<TColumns>.UniqueConstraint 方法

定義

在資料表上設定唯一條件約束。

public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddUniqueConstraintOperation> UniqueConstraint (string name, System.Linq.Expressions.Expression<Func<TColumns,object>> columns);
abstract member UniqueConstraint : string * System.Linq.Expressions.Expression<Func<'Columns, obj>> -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddUniqueConstraintOperation>
override this.UniqueConstraint : string * System.Linq.Expressions.Expression<Func<'Columns, obj>> -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddUniqueConstraintOperation>
Public Overridable Function UniqueConstraint (name As String, columns As Expression(Of Func(Of TColumns, Object))) As OperationBuilder(Of AddUniqueConstraintOperation)

參數

name
String

條件約束名稱。

columns
Expression<Func<TColumns,Object>>

組成條件約束的資料行。

傳回

相同的產生器,讓多個呼叫可以鏈結。

適用於