Share via


IConventionKey 接口

定义

表示实体上的主键或备用键。

public interface IConventionKey : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IKey
public interface IConventionKey : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey
type IConventionKey = interface
    interface IConventionAnnotatable
    interface IAnnotatable
    interface IKey
type IConventionKey = interface
    interface IReadOnlyKey
    interface IReadOnlyAnnotatable
    interface IConventionAnnotatable
Public Interface IConventionKey
Implements IConventionAnnotatable, IKey
Public Interface IConventionKey
Implements IConventionAnnotatable, IReadOnlyKey
实现

注解

此接口在模型创建期间使用,并允许修改元数据。 生成模型后, IKey 表示相同元数据的只读视图。

有关详细信息和示例,请参阅 模型生成约定

属性

Builder

获取可用于配置此密钥的生成器。

DeclaringEntityType

获取定义键的实体类型。 这可能不同于在继承层次结构中为键定义派生类型时定义的类型 Properties (,因为这些属性可以在基类型) 上定义。

IsInModel

指示此对象是否在模型中,即尚未从模型中删除。

(继承自 IConventionAnnotatable)
Item[String]

获取具有给定名称的批注的值,如果不存在,则返回 null

(继承自 IReadOnlyAnnotatable)
Properties

获取构成键的属性。

方法

AddAnnotation(String, Object, Boolean)

向此对象添加批注。 如果已存在具有指定名称的批注,则引发 。

(继承自 IConventionAnnotatable)
AddAnnotations(IEnumerable<IConventionAnnotation>, Boolean)

向 对象添加批注。

(继承自 IConventionAnnotatable)
AddRuntimeAnnotation(String, Object)

向此对象添加运行时批注。 如果已存在具有指定名称的批注,则引发 。

(继承自 IAnnotatable)
AnnotationsToDebugString(Int32)

获取对象上声明的所有注释的调试字符串。

(继承自 IReadOnlyAnnotatable)
FindAnnotation(String)

获取具有给定名称的批注,如果不存在,则返回 null

(继承自 IReadOnlyAnnotatable)
FindRuntimeAnnotation(String)

获取具有给定名称的运行时注释,如果不存在,则返回 null

(继承自 IAnnotatable)
FindRuntimeAnnotationValue(String)

获取具有给定名称的运行时注释的值,如果不存在,则返回 null

(继承自 IAnnotatable)
GetAnnotation(String)

获取具有给定名称的批注,如果不存在,则引发该批注。

(继承自 IReadOnlyAnnotatable)
GetAnnotations()

获取当前 对象上的所有注释。

(继承自 IReadOnlyAnnotatable)
GetConfigurationSource()

返回此密钥的配置源。

GetKeyType()

返回简单键的键属性的类型,或复合键的对象数组。

(继承自 IKey)
GetOrAddRuntimeAnnotationValue<TValue,TArg>(String, Func<TArg,TValue>, TArg)

获取具有给定名称的运行时注释的值,如果不存在,则添加该值。

(继承自 IAnnotatable)
GetPrincipalKeyValueFactory()

根据从各种形式的实体数据中提取的键值获取键值的工厂。

此方法通常由数据库提供程序 (和其他扩展) 使用。 它通常不在应用程序代码中使用。

(继承自 IKey)
GetPrincipalKeyValueFactory<TKey>()

根据从各种形式的实体数据中提取的键值获取键值的工厂。

此方法通常由数据库提供程序 (和其他扩展) 使用。 它通常不在应用程序代码中使用。

(继承自 IKey)
GetReferencingForeignKeys()

获取面向给定主键或备用键的所有外键。

GetRuntimeAnnotations()

获取当前 对象上的所有运行时注释。

(继承自 IAnnotatable)
IsPrimaryKey()

返回一个值,该值指示键是否为主键。

(继承自 IReadOnlyKey)
RemoveAnnotation(String)

从此 对象中删除具有给定名称的批注。

(继承自 IConventionAnnotatable)
RemoveRuntimeAnnotation(String)

从此 对象中删除给定的运行时批注。

(继承自 IAnnotatable)
SetAnnotation(String, Object, Boolean)

设置存储在给定名称下的批注。 如果具有指定名称的批注已存在,则覆盖现有批注。

(继承自 IConventionAnnotatable)
SetOrRemoveAnnotation(String, Object, Boolean)

设置存储在给定名称下的批注。 如果具有指定名称的批注已存在,则覆盖现有批注。 如果 null 提供了 ,则删除现有批注。

(继承自 IConventionAnnotatable)
SetRuntimeAnnotation(String, Object)

设置存储在给定键下的运行时注释。 如果具有指定名称的批注已存在,则覆盖现有批注。

(继承自 IAnnotatable)
ToDebugString(MetadataDebugStringOptions, Int32)

创建给定元数据的可读表示形式。

警告:不要依赖于返回的字符串的格式。 它仅用于调试,并且可能会在版本之间任意更改。

(继承自 IReadOnlyKey)

扩展方法

AddAnnotations(IConventionAnnotatable, IEnumerable<IConventionAnnotation>, Boolean)

向 对象添加批注。

GetAnnotation(IConventionAnnotatable, String)

获取具有给定名称的批注,如果不存在,则引发该批注。

SetOrRemoveAnnotation(IConventionAnnotatable, String, Object, Boolean)

设置存储在给定名称下的批注。 如果具有指定名称的批注已存在,则覆盖现有批注。 如果 null 提供了 ,则删除现有批注。

GetReferencingForeignKeys(IConventionKey)

获取面向给定主键或备用键的所有外键。

AnnotationsToDebugString(IAnnotatable, Int32)

获取对象上声明的所有注释的调试字符串。

GetAnnotation(IAnnotatable, String)

获取具有给定名称的批注,如果不存在,则引发该批注。

GetKeyType(IKey)

返回简单键的键属性的类型,或复合键的对象数组。

GetPrincipalKeyValueFactory<TKey>(IKey)

根据从各种实体数据形式的索引键值获取键值的工厂。

此方法通常由数据库提供程序 (和其他扩展) 使用。 它通常不在应用程序代码中使用。

GetReferencingForeignKeys(IKey)

获取面向给定主键或备用键的所有外键。

IsPrimaryKey(IKey)

返回一个值,该值指示键是否为主键。

ToDebugString(IKey, MetadataDebugStringOptions, Int32)

创建给定元数据的可读表示形式。

警告:不要依赖于返回的字符串的格式。 它仅用于调试,并且可能会在版本之间任意更改。

FindSharedObjectRootKey(IConventionKey, StoreObjectIdentifier)

在类似于共享表的对象中查找映射到同一约束的第 IConventionKey 一个 。

此方法通常由数据库提供程序 (和其他扩展) 使用。 它通常不在应用程序代码中使用。

FindSharedObjectRootKey(IKey, StoreObjectIdentifier)

在类似于共享表的对象中查找映射到同一约束的第 IConventionKey 一个 。

此方法通常由数据库提供程序 (和其他扩展) 使用。 它通常不在应用程序代码中使用。

FindSharedObjectRootKey(IReadOnlyKey, StoreObjectIdentifier)

在类似于共享表的对象中查找映射到同一约束的第 IKey 一个 。

此方法通常由数据库提供程序 (和其他扩展) 使用。 它通常不在应用程序代码中使用。

GetDefaultName(IKey)

返回将用于此键的默认键约束名称。

GetDefaultName(IKey, StoreObjectIdentifier)

返回将用于特定表的此键的默认键约束名称。

GetDefaultName(IReadOnlyKey)

返回将用于此键的默认键约束名称。

GetDefaultName(IReadOnlyKey, StoreObjectIdentifier)

返回将用于特定表的此键的默认键约束名称。

GetMappedConstraints(IKey)

获取键映射到的唯一约束。

GetName(IKey)

返回此键的键约束名称。

GetName(IKey, StoreObjectIdentifier)

返回特定表的此键的键约束名称。

GetName(IReadOnlyKey)

返回此键的键约束名称。

GetName(IReadOnlyKey, StoreObjectIdentifier)

返回特定表的此键的键约束名称。

GetNameConfigurationSource(IConventionKey)

ConfigurationSource获取约束名称的 。

SetName(IConventionKey, String, Boolean)

设置此键的键约束名称。

GetIsClusteredConfigurationSource(IConventionKey)

获取 ConfigurationSource 指示密钥是否为群集的 。

IsClustered(IKey)

返回一个值,该值指示键是否为聚集项。

IsClustered(IKey, StoreObjectIdentifier)

返回一个值,该值指示键是否为聚集项。

IsClustered(IReadOnlyKey)

返回一个值,该值指示键是否为聚集项。

IsClustered(IReadOnlyKey, StoreObjectIdentifier)

返回一个值,该值指示键是否为聚集项。

SetIsClustered(IConventionKey, Nullable<Boolean>, Boolean)

设置一个值,该值指示键是否聚集。

适用于