ConventionEntityTypeExtensions.AddKey 方法

定义

向此实体类型添加新的备用键。

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

参数

entityType
IConventionEntityType

实体类型。

property
IConventionProperty

要用作备用键的属性。

fromDataAnnotation
Boolean

指示配置是否是使用数据注释指定的。

返回

新创建的密钥。

适用于