RuntimeForeignKey 类

定义

表示一种关系,其中由依赖实体类型上的属性组成的外键引用主体实体类型上的相应主键或备用键。

public class RuntimeForeignKey : Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableBase, Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeForeignKey
type RuntimeForeignKey = class
    inherit AnnotatableBase
    interface IRuntimeForeignKey
    interface IForeignKey
    interface IReadOnlyForeignKey
    interface IReadOnlyAnnotatable
    interface IAnnotatable
Public Class RuntimeForeignKey
Inherits AnnotatableBase
Implements IRuntimeForeignKey
继承
RuntimeForeignKey
实现
IAnnotatable IReadOnlyAnnotatable IForeignKey Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeForeignKey IReadOnlyForeignKey

注解

有关详细信息和示例,请参阅 为实体类型和关系建模

构造函数

RuntimeForeignKey(IReadOnlyList<RuntimeProperty>, RuntimeKey, RuntimeEntityType, RuntimeEntityType, DeleteBehavior, Boolean, Boolean, Boolean, Boolean)

这是一个支持 Entity Framework Core 基础结构的内部 API,不受与公共 API 相同的兼容性标准的约束。 可能会在任何版本中更改或删除它,而无需通知。 仅应在代码中非常谨慎地直接使用它,并且知道在更新到新的 Entity Framework Core 版本时这样做可能会导致应用程序失败。

属性

DebugView

这是一个支持 Entity Framework Core 基础结构的内部 API,不受与公共 API 相同的兼容性标准的约束。 可能会在任何版本中更改或删除它,而无需通知。 仅应在代码中非常谨慎地直接使用它,并且知道在更新到新的 Entity Framework Core 版本时这样做可能会导致应用程序失败。

DeclaringEntityType

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

IsReadOnly

指示当前对象是否为只读。

(继承自 AnnotatableBase)
Item[String]

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

(继承自 AnnotatableBase)
PrincipalEntityType

获取此关系面向的主体实体类型。 这可能不同于关系以继承层次结构 (派生类型为目标时定义的类型 PrincipalKey ,因为键是在层次结构) 基类型上定义的。

PrincipalKey

获取关系面向的主键或备用键。

Properties

获取依赖实体中的外键属性。

ReferencingSkipNavigations

这是一个支持 Entity Framework Core 基础结构的内部 API,不受与公共 API 相同的兼容性标准的约束。 可能会在任何版本中更改或删除它,而无需通知。 仅应在代码中非常谨慎地直接使用它,并且知道在更新到新的 Entity Framework Core 版本时这样做可能会导致应用程序失败。

方法

AddAnnotation(String, Annotation)

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

(继承自 AnnotatableBase)
AddAnnotation(String, Object)

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

(继承自 AnnotatableBase)
AddAnnotations(IEnumerable<IAnnotation>)

向此对象添加批注。

(继承自 AnnotatableBase)
AddAnnotations(IReadOnlyDictionary<String,Object>)

向此对象添加批注。

(继承自 AnnotatableBase)
AddNavigation(RuntimeNavigation, Boolean)

这是一个支持 Entity Framework Core 基础结构的内部 API,不受与公共 API 相同的兼容性标准的约束。 可能会在任何版本中更改或删除它,而无需通知。 仅应在代码中非常谨慎地直接使用它,并且知道在更新到新的 Entity Framework Core 版本时这样做可能会导致应用程序失败。

AddRuntimeAnnotation(String, Annotation)

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

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

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

(继承自 AnnotatableBase)
AddRuntimeAnnotations(IEnumerable<Annotation>)

向此对象添加运行时批注。

(继承自 AnnotatableBase)
AddRuntimeAnnotations(IReadOnlyDictionary<String,Object>)

向此对象添加运行时批注。

(继承自 AnnotatableBase)
CreateAnnotation(String, Object)

创建新批注。

(继承自 AnnotatableBase)
CreateRuntimeAnnotation(String, Object)

创建新的运行时批注。

(继承自 AnnotatableBase)
EnsureMutable()

如果模型为只读,则引发。

(继承自 AnnotatableBase)
EnsureReadOnly()

如果模型不是只读的,则引发 。

(继承自 AnnotatableBase)
FindAnnotation(String)

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

(继承自 AnnotatableBase)
FindRuntimeAnnotation(String)

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

(继承自 AnnotatableBase)
GetAnnotation(String)

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

(继承自 AnnotatableBase)
GetAnnotations()

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

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

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

(继承自 AnnotatableBase)
GetRuntimeAnnotations()

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

(继承自 AnnotatableBase)
OnAnnotationSet(String, Annotation, Annotation)

设置或删除批注时调用。

(继承自 AnnotatableBase)
RemoveAnnotation(String)

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

(继承自 AnnotatableBase)
RemoveRuntimeAnnotation(String)

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

(继承自 AnnotatableBase)
SetAnnotation(String, Annotation, Annotation)

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

(继承自 AnnotatableBase)
SetAnnotation(String, Object)

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

(继承自 AnnotatableBase)
SetRuntimeAnnotation(String, Annotation, Annotation)

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

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

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

(继承自 AnnotatableBase)
ToString()

返回表示当前对象的字符串。

显式接口实现

IAnnotatable.AddRuntimeAnnotation(String, Object)

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

(继承自 AnnotatableBase)
IAnnotatable.FindRuntimeAnnotation(String)

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

(继承自 AnnotatableBase)
IAnnotatable.GetRuntimeAnnotations()

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

(继承自 AnnotatableBase)
IAnnotatable.RemoveRuntimeAnnotation(String)

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

(继承自 AnnotatableBase)
IAnnotatable.SetRuntimeAnnotation(String, Object)

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

(继承自 AnnotatableBase)
IForeignKey.DeclaringEntityType

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

IForeignKey.DependentToPrincipal

获取指向主体实体的依赖实体类型上的导航属性。

IForeignKey.GetDependentKeyValueFactory()

基于从各种形式的实体数据中获取的外键值为键值创建工厂。

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

IForeignKey.GetDependentKeyValueFactory<TKey>()

基于从各种形式的实体数据中获取的外键值为键值创建工厂。

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

IForeignKey.PrincipalEntityType

获取此关系面向的主体实体类型。 这可能不同于关系以继承层次结构 (派生类型为目标时定义的类型 PrincipalKey ,因为键是在层次结构) 基类型上定义的。

IForeignKey.PrincipalKey

获取关系面向的主键或备用键。

IForeignKey.PrincipalToDependent

获取指向依赖实体的主体实体类型上的导航属性。

IForeignKey.Properties

获取依赖实体中的外键属性。

IReadOnlyAnnotatable.FindAnnotation(String)

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

(继承自 AnnotatableBase)
IReadOnlyAnnotatable.GetAnnotations()

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

(继承自 AnnotatableBase)
IReadOnlyAnnotatable.Item[String]

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

(继承自 AnnotatableBase)
IReadOnlyForeignKey.DeclaringEntityType

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

IReadOnlyForeignKey.DeleteBehavior

获取一个值,该值指示在删除主体或断开关系时如何将删除操作应用于关系中的依赖实体。

IReadOnlyForeignKey.DependentToPrincipal

获取指向主体实体的依赖实体类型上的导航属性。

IReadOnlyForeignKey.GetReferencingSkipNavigations()

使用此外键获取跳过导航。

IReadOnlyForeignKey.IsOwnership

获取一个值,该值指示此关系是否定义所有权。 如果 true为 ,则必须始终通过主体实体的导航访问依赖实体。

IReadOnlyForeignKey.IsRequired

获取一个值,该值指示是否需要主体实体。 如果 true为 ,则必须始终将依赖实体分配给有效的主体实体。

IReadOnlyForeignKey.IsRequiredDependent

获取一个值,该值指示是否需要依赖实体。 如果 true为 ,则主体实体必须始终分配有效的依赖实体。

IReadOnlyForeignKey.IsUnique

获取一个值,该值指示分配给外键属性的值是否是唯一的。

IReadOnlyForeignKey.PrincipalEntityType

获取此关系面向的主体实体类型。 这可能不同于关系以继承层次结构 (派生类型为目标时定义的类型 PrincipalKey ,因为键是在层次结构) 基类型上定义的。

IReadOnlyForeignKey.PrincipalKey

获取关系面向的主键或备用键。

IReadOnlyForeignKey.PrincipalToDependent

获取指向依赖实体的主体实体类型上的导航属性。

IReadOnlyForeignKey.Properties

获取依赖实体中的外键属性。

IRuntimeForeignKey.DependentKeyValueFactory

表示一种关系,其中由依赖实体类型上的属性组成的外键引用主体实体类型上的相应主键或备用键。

IRuntimeForeignKey.DependentsMapFactory

表示一种关系,其中由依赖实体类型上的属性组成的外键引用主体实体类型上的相应主键或备用键。

扩展方法

GetDependentKeyValueFactory<TKey>(IForeignKey)

基于从各种形式的实体数据中获取的外键值为键值创建工厂。

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

GetNavigation(IForeignKey, Boolean)

返回与此外键关联的导航。

GetRelatedEntityType(IForeignKey, IEntityType)

获取与给定实体类型相关的实体类型。

IsBaseLinking(IForeignKey)

返回一个值,该值指示外键是否在主键上定义并指向同一主键。

ToDebugString(IForeignKey, MetadataDebugStringOptions, Int32)

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

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

AnnotationsToDebugString(IAnnotatable, Int32)

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

FindSharedObjectRootForeignKey(IForeignKey, StoreObjectIdentifier)

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

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

FindSharedObjectRootForeignKey(IReadOnlyForeignKey, StoreObjectIdentifier)

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

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

GetConstraintName(IForeignKey)

返回外键约束名称。

GetConstraintName(IForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

返回外键约束名称。

GetConstraintName(IReadOnlyForeignKey)

返回外键约束名称。

GetConstraintName(IReadOnlyForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

返回外键约束名称。

GetDefaultName(IForeignKey)

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

GetDefaultName(IForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

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

GetDefaultName(IReadOnlyForeignKey)

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

GetDefaultName(IReadOnlyForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

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

GetMappedConstraints(IForeignKey)

获取外键映射到的外键约束。

IsRowInternal(IReadOnlyForeignKey, StoreObjectIdentifier)

返回一个值,该值指示此外键是否在共享同一表类似存储对象的两个实体类型之间。

GetFluentApiCalls(IForeignKey, IAnnotationCodeGenerator, Boolean)

获取用于配置外键的 fluent API 调用。

适用于