Condividi tramite


RuntimeForeignKey Class

Definition

Represents a relationship where a foreign key composed of properties on the dependent entity type references a corresponding primary or alternate key on the principal entity type.

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

Remarks

See Modeling entity types and relationships for more information and examples.

Constructors

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

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

Properties

DebugView

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

DeclaringEntityType

Gets the dependent entity type. This may be different from the type that Properties are defined on when the relationship is defined a derived type in an inheritance hierarchy (since the properties may be defined on a base type).

IsReadOnly

Indicates whether the current object is read-only.

(Inherited from AnnotatableBase)
Item[String]

Gets the value annotation with the given name, returning null if it does not exist.

(Inherited from AnnotatableBase)
Item[String]

Gets the value annotation with the given name, returning null if it does not exist.

(Inherited from RuntimeAnnotatableBase)
PrincipalEntityType

Gets the principal entity type that this relationship targets. This may be different from the type that PrincipalKey is defined on when the relationship targets a derived type in an inheritance hierarchy (since the key is defined on the base type of the hierarchy).

PrincipalKey

Gets the primary or alternate key that the relationship targets.

Properties

Gets the foreign key properties in the dependent entity.

ReferencingSkipNavigations

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

Methods

AddAnnotation(String, Annotation)

Adds an annotation to this object. Throws if an annotation with the specified name already exists.

(Inherited from AnnotatableBase)
AddAnnotation(String, Object)

Adds an annotation to this object. Throws if an annotation with the specified name already exists.

(Inherited from AnnotatableBase)
AddAnnotation(String, Object)

Adds an annotation to this object. Throws if an annotation with the specified name already exists.

(Inherited from RuntimeAnnotatableBase)
AddAnnotations(IEnumerable<IAnnotation>)

Adds annotations to this object.

(Inherited from AnnotatableBase)
AddAnnotations(IEnumerable<IAnnotation>)

Adds annotations to this object overriding any existing annotations with the same name.

(Inherited from RuntimeAnnotatableBase)
AddAnnotations(IReadOnlyDictionary<String,Object>)

Adds annotations to this object.

(Inherited from AnnotatableBase)
AddAnnotations(IReadOnlyDictionary<String,Object>)

Adds annotations to this object overriding any existing annotations with the same name.

(Inherited from RuntimeAnnotatableBase)
AddNavigation(RuntimeNavigation, Boolean)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

AddRuntimeAnnotation(String, Annotation)

Adds a runtime annotation to this object. Throws if an annotation with the specified name already exists.

(Inherited from AnnotatableBase)
AddRuntimeAnnotation(String, Annotation)

Adds a runtime annotation to this object. Throws if an annotation with the specified name already exists.

(Inherited from RuntimeAnnotatableBase)
AddRuntimeAnnotation(String, Object)

Adds a runtime annotation to this object. Throws if an annotation with the specified name already exists.

(Inherited from AnnotatableBase)
AddRuntimeAnnotation(String, Object)

Adds a runtime annotation to this object. Throws if an annotation with the specified name already exists.

(Inherited from RuntimeAnnotatableBase)
AddRuntimeAnnotations(IEnumerable<Annotation>)

Adds runtime annotations to this object.

(Inherited from AnnotatableBase)
AddRuntimeAnnotations(IEnumerable<Annotation>)

Adds runtime annotations to this object.

(Inherited from RuntimeAnnotatableBase)
AddRuntimeAnnotations(IReadOnlyDictionary<String,Object>)

Adds runtime annotations to this object.

(Inherited from AnnotatableBase)
AddRuntimeAnnotations(IReadOnlyDictionary<String,Object>)

Adds runtime annotations to this object.

(Inherited from RuntimeAnnotatableBase)
CreateAnnotation(String, Object)

Creates a new annotation.

(Inherited from AnnotatableBase)
CreateAnnotation(String, Object)

Creates a new annotation.

(Inherited from RuntimeAnnotatableBase)
CreateRuntimeAnnotation(String, Object)

Creates a new runtime annotation.

(Inherited from AnnotatableBase)
CreateRuntimeAnnotation(String, Object)

Creates a new runtime annotation.

(Inherited from RuntimeAnnotatableBase)
EnsureMutable()

Throws if the model is read-only.

(Inherited from AnnotatableBase)
EnsureReadOnly()

Throws if the model is not read-only.

(Inherited from AnnotatableBase)
FindAnnotation(String)

Gets the annotation with the given name, returning null if it does not exist.

(Inherited from AnnotatableBase)
FindAnnotation(String)

Gets the annotation with the given name, returning null if it does not exist.

(Inherited from RuntimeAnnotatableBase)
FindRuntimeAnnotation(String)

Gets the runtime annotation with the given name, returning null if it does not exist.

(Inherited from AnnotatableBase)
FindRuntimeAnnotation(String)

Gets the runtime annotation with the given name, returning null if it does not exist.

(Inherited from RuntimeAnnotatableBase)
GetAnnotation(String)

Gets the annotation with the given name, throwing if it does not exist.

(Inherited from AnnotatableBase)
GetAnnotation(String)

Gets the annotation with the given name, throwing if it does not exist.

(Inherited from RuntimeAnnotatableBase)
GetAnnotations()

Gets all annotations on the current object.

(Inherited from AnnotatableBase)
GetOrAddRuntimeAnnotationValue<TValue,TArg>(String, Func<TArg,TValue>, TArg)

Gets the value of the runtime annotation with the given name, adding it if one does not exist.

(Inherited from AnnotatableBase)
GetOrAddRuntimeAnnotationValue<TValue,TArg>(String, Func<TArg,TValue>, TArg)

Gets the value of the runtime annotation with the given name, adding it if one does not exist.

(Inherited from RuntimeAnnotatableBase)
GetRuntimeAnnotations()

Gets all runtime annotations on the current object.

(Inherited from AnnotatableBase)
GetRuntimeAnnotations()

Gets all runtime annotations on the current object.

(Inherited from RuntimeAnnotatableBase)
OnAnnotationSet(String, Annotation, Annotation)

Called when an annotation was set or removed.

(Inherited from AnnotatableBase)
RemoveAnnotation(String)

Removes the given annotation from this object.

(Inherited from AnnotatableBase)
RemoveAnnotation(String)

Removes the given annotation from this object.

(Inherited from RuntimeAnnotatableBase)
RemoveRuntimeAnnotation(String)

Removes the given runtime annotation from this object.

(Inherited from AnnotatableBase)
RemoveRuntimeAnnotation(String)

Removes the given runtime annotation from this object.

(Inherited from RuntimeAnnotatableBase)
SetAnnotation(String, Annotation, Annotation)

Sets the annotation stored under the given key. Overwrites the existing annotation if an annotation with the specified name already exists.

(Inherited from AnnotatableBase)
SetAnnotation(String, Object)

Sets the annotation stored under the given key. Overwrites the existing annotation if an annotation with the specified name already exists.

(Inherited from AnnotatableBase)
SetAnnotation(String, Object)

Sets the annotation stored under the given key. Overwrites the existing annotation if an annotation with the specified name already exists.

(Inherited from RuntimeAnnotatableBase)
SetRuntimeAnnotation(String, Annotation, Annotation)

Sets the runtime annotation stored under the given key. Overwrites the existing annotation if an annotation with the specified name already exists.

(Inherited from AnnotatableBase)
SetRuntimeAnnotation(String, Annotation, Annotation)

Sets the runtime annotation stored under the given key. Overwrites the existing annotation if an annotation with the specified name already exists.

(Inherited from RuntimeAnnotatableBase)
SetRuntimeAnnotation(String, Object)

Sets the runtime annotation stored under the given key. Overwrites the existing annotation if an annotation with the specified name already exists.

(Inherited from AnnotatableBase)
SetRuntimeAnnotation(String, Object)

Sets the runtime annotation stored under the given key. Overwrites the existing annotation if an annotation with the specified name already exists.

(Inherited from RuntimeAnnotatableBase)
ToString()

Returns a string that represents the current object.

Explicit Interface Implementations

IAnnotatable.AddRuntimeAnnotation(String, Object)

Adds a runtime annotation to this object. Throws if an annotation with the specified name already exists.

(Inherited from AnnotatableBase)
IAnnotatable.AddRuntimeAnnotation(String, Object)

Adds a runtime annotation to this object. Throws if an annotation with the specified name already exists.

(Inherited from RuntimeAnnotatableBase)
IAnnotatable.FindRuntimeAnnotation(String)

Gets the runtime annotation with the given name, returning null if it does not exist.

(Inherited from AnnotatableBase)
IAnnotatable.FindRuntimeAnnotation(String)

Gets the runtime annotation with the given name, returning null if it does not exist.

(Inherited from RuntimeAnnotatableBase)
IAnnotatable.GetRuntimeAnnotations()

Gets all the runtime annotations on the current object.

(Inherited from AnnotatableBase)
IAnnotatable.GetRuntimeAnnotations()

Gets all the runtime annotations on the current object.

(Inherited from RuntimeAnnotatableBase)
IAnnotatable.RemoveRuntimeAnnotation(String)

Removes the given runtime annotation from this object.

(Inherited from AnnotatableBase)
IAnnotatable.RemoveRuntimeAnnotation(String)

Removes the given runtime annotation from this object.

(Inherited from RuntimeAnnotatableBase)
IAnnotatable.SetRuntimeAnnotation(String, Object)

Sets the runtime annotation stored under the given key. Overwrites the existing annotation if an annotation with the specified name already exists.

(Inherited from AnnotatableBase)
IAnnotatable.SetRuntimeAnnotation(String, Object)

Sets the runtime annotation stored under the given key. Overwrites the existing annotation if an annotation with the specified name already exists.

(Inherited from RuntimeAnnotatableBase)
IForeignKey.DeclaringEntityType

Gets the dependent entity type. This may be different from the type that Properties are defined on when the relationship is defined a derived type in an inheritance hierarchy (since the properties may be defined on a base type).

IForeignKey.DependentToPrincipal

Gets the navigation property on the dependent entity type that points to the principal entity.

IForeignKey.GetDependentKeyValueFactory()

Creates a factory for key values based on the foreign key values taken from various forms of entity data.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

IForeignKey.GetDependentKeyValueFactory<TKey>()

Creates a factory for key values based on the foreign key values taken from various forms of entity data.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

IForeignKey.PrincipalEntityType

Gets the principal entity type that this relationship targets. This may be different from the type that PrincipalKey is defined on when the relationship targets a derived type in an inheritance hierarchy (since the key is defined on the base type of the hierarchy).

IForeignKey.PrincipalKey

Gets the primary or alternate key that the relationship targets.

IForeignKey.PrincipalToDependent

Gets the navigation property on the principal entity type that points to the dependent entity.

IForeignKey.Properties

Gets the foreign key properties in the dependent entity.

IReadOnlyAnnotatable.FindAnnotation(String)

Gets the annotation with the given name, returning null if it does not exist.

(Inherited from AnnotatableBase)
IReadOnlyAnnotatable.FindAnnotation(String)

Gets the annotation with the given name, returning null if it does not exist.

(Inherited from RuntimeAnnotatableBase)
IReadOnlyAnnotatable.GetAnnotations()

Gets all annotations on the current object.

(Inherited from AnnotatableBase)
IReadOnlyAnnotatable.GetAnnotations()

Gets all annotations on the current object.

(Inherited from RuntimeAnnotatableBase)
IReadOnlyAnnotatable.Item[String]

Gets the value of the annotation with the given name, returning null if it does not exist.

(Inherited from AnnotatableBase)
IReadOnlyAnnotatable.Item[String]

Gets the value of the annotation with the given name, returning null if it does not exist.

(Inherited from RuntimeAnnotatableBase)
IReadOnlyForeignKey.DeclaringEntityType

Gets the dependent entity type. This may be different from the type that Properties are defined on when the relationship is defined a derived type in an inheritance hierarchy (since the properties may be defined on a base type).

IReadOnlyForeignKey.DeleteBehavior

Gets a value indicating how a delete operation is applied to dependent entities in the relationship when the principal is deleted or the relationship is severed.

IReadOnlyForeignKey.DependentToPrincipal

Gets the navigation property on the dependent entity type that points to the principal entity.

IReadOnlyForeignKey.GetReferencingSkipNavigations()

Gets the skip navigations using this foreign key.

IReadOnlyForeignKey.IsOwnership

Gets a value indicating whether this relationship defines an ownership. If true, the dependent entity must always be accessed via the navigation from the principal entity.

IReadOnlyForeignKey.IsRequired

Gets a value indicating whether the principal entity is required. If true, the dependent entity must always be assigned to a valid principal entity.

IReadOnlyForeignKey.IsRequiredDependent

Gets a value indicating whether the dependent entity is required. If true, the principal entity must always have a valid dependent entity assigned.

IReadOnlyForeignKey.IsUnique

Gets a value indicating whether the values assigned to the foreign key properties are unique.

IReadOnlyForeignKey.PrincipalEntityType

Gets the principal entity type that this relationship targets. This may be different from the type that PrincipalKey is defined on when the relationship targets a derived type in an inheritance hierarchy (since the key is defined on the base type of the hierarchy).

IReadOnlyForeignKey.PrincipalKey

Gets the primary or alternate key that the relationship targets.

IReadOnlyForeignKey.PrincipalToDependent

Gets the navigation property on the principal entity type that points to the dependent entity.

IReadOnlyForeignKey.Properties

Gets the foreign key properties in the dependent entity.

IRuntimeForeignKey.DependentKeyValueFactory Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeForeignKey.DependentKeyValueFactory
IRuntimeForeignKey.DependentsMapFactory Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeForeignKey.DependentsMapFactory

Extension Methods

GetDependentKeyValueFactory<TKey>(IForeignKey)

Creates a factory for key values based on the foreign key values taken from various forms of entity data.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

GetNavigation(IForeignKey, Boolean)

Returns a navigation associated with this foreign key.

GetRelatedEntityType(IForeignKey, IEntityType)

Gets the entity type related to the given one.

IsBaseLinking(IForeignKey)

Returns a value indicating whether the foreign key is defined on the primary key and pointing to the same primary key.

ToDebugString(IForeignKey, MetadataDebugStringOptions, Int32)

Creates a human-readable representation of the given metadata.

Warning: Do not rely on the format of the returned string. It is designed for debugging only and may change arbitrarily between releases.

AnnotationsToDebugString(IAnnotatable, Int32)

Gets the debug string for all annotations declared on the object.

FindSharedObjectRootForeignKey(IForeignKey, StoreObjectIdentifier)

Finds the first IForeignKey that is mapped to the same constraint in a shared table-like object.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

FindSharedObjectRootForeignKey(IReadOnlyForeignKey, StoreObjectIdentifier)

Finds the first IForeignKey that is mapped to the same constraint in a shared table-like object.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

GetConstraintName(IForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

Returns the foreign key constraint name.

GetConstraintName(IForeignKey)

Returns the foreign key constraint name.

GetConstraintName(IReadOnlyForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

Returns the foreign key constraint name.

GetConstraintName(IReadOnlyForeignKey)

Returns the foreign key constraint name.

GetDefaultName(IForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

Returns the default constraint name that would be used for this foreign key.

GetDefaultName(IForeignKey)

Returns the default constraint name that would be used for this foreign key.

GetDefaultName(IReadOnlyForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

Returns the default constraint name that would be used for this foreign key.

GetDefaultName(IReadOnlyForeignKey)

Returns the default constraint name that would be used for this foreign key.

GetMappedConstraints(IForeignKey)

Gets the foreign key constraints to which the foreign key is mapped.

IsRowInternal(IReadOnlyForeignKey, StoreObjectIdentifier)

Returns a value indicating whether this foreign key is between two entity types sharing the same table-like store object.

GetFluentApiCalls(IForeignKey, IAnnotationCodeGenerator, Boolean)

Gets the fluent API calls to configure a foreign key.

Applies to