ConventionEntityTypeExtensions.SetPrimaryKey 方法

定義

設定這個實體類型的主鍵。

public static Microsoft.EntityFrameworkCore.Metadata.IConventionKey SetPrimaryKey (this Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType entityType, Microsoft.EntityFrameworkCore.Metadata.IConventionProperty property, bool fromDataAnnotation = false);
static member SetPrimaryKey : Microsoft.EntityFrameworkCore.Metadata.IConventionEntityType * Microsoft.EntityFrameworkCore.Metadata.IConventionProperty * bool -> Microsoft.EntityFrameworkCore.Metadata.IConventionKey
<Extension()>
Public Function SetPrimaryKey (entityType As IConventionEntityType, property As IConventionProperty, Optional fromDataAnnotation As Boolean = false) As IConventionKey

參數

entityType
IConventionEntityType

要設定索引鍵的實體類型。

property
IConventionProperty

主鍵屬性。

fromDataAnnotation
Boolean

指出是否已使用資料批註指定組態。

傳回

新建立的金鑰。

適用於