共用方式為


CreateTableBuilder<TColumns>.PrimaryKey 方法

定義

在資料表上設定主鍵。

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

參數

name
String

主鍵條件約束名稱。

columns
Expression<Func<TColumns,Object>>

組成主鍵的資料行。

傳回

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

適用於