EntityTypeExtensions.FindKey(IEntityType, IProperty) 方法

定义

获取在给定属性上定义的主键或备用键。 null如果未为给定属性定义任何键,则返回 。

public static Microsoft.EntityFrameworkCore.Metadata.IKey FindKey (this Microsoft.EntityFrameworkCore.Metadata.IEntityType entityType, Microsoft.EntityFrameworkCore.Metadata.IProperty property);
static member FindKey : Microsoft.EntityFrameworkCore.Metadata.IEntityType * Microsoft.EntityFrameworkCore.Metadata.IProperty -> Microsoft.EntityFrameworkCore.Metadata.IKey
<Extension()>
Public Function FindKey (entityType As IEntityType, property As IProperty) As IKey

参数

entityType
IEntityType

实体类型。

property
IProperty

用于定义键的属性。

返回

键,如果未定义,则为 null。

适用于