Table of Contents

Class RuntimeForeignKey

Namespace
Microsoft.EntityFrameworkCore.Metadata
Assembly
Microsoft.EntityFrameworkCore.dll

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 : AnnotatableBase, IRuntimeForeignKey, IForeignKey, IReadOnlyForeignKey, IAnnotatable, IReadOnlyAnnotatable
Inheritance
RuntimeForeignKey
Implements
Inherited Members
Extension Methods

Remarks

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

Constructors

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

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.

[EntityFrameworkInternal]
public RuntimeForeignKey(IReadOnlyList<RuntimeProperty> dependentProperties, RuntimeKey principalKey, RuntimeEntityType dependentEntityType, RuntimeEntityType principalEntityType, DeleteBehavior deleteBehavior, bool unique, bool required, bool requiredDependent, bool ownership)

Parameters

dependentProperties IReadOnlyList<RuntimeProperty>
principalKey RuntimeKey
dependentEntityType RuntimeEntityType
principalEntityType RuntimeEntityType
deleteBehavior DeleteBehavior
unique bool
required bool
requiredDependent bool
ownership bool

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.

[EntityFrameworkInternal]
public virtual DebugView DebugView { get; }

Property Value

DebugView

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).

public virtual RuntimeEntityType DeclaringEntityType { get; }

Property Value

RuntimeEntityType

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).

public virtual RuntimeEntityType PrincipalEntityType { get; }

Property Value

RuntimeEntityType

PrincipalKey

Gets the primary or alternate key that the relationship targets.

public virtual RuntimeKey PrincipalKey { get; }

Property Value

RuntimeKey

Properties

Gets the foreign key properties in the dependent entity.

public virtual IReadOnlyList<RuntimeProperty> Properties { get; }

Property Value

IReadOnlyList<RuntimeProperty>

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.

[EntityFrameworkInternal]
public virtual ISet<RuntimeSkipNavigation>? ReferencingSkipNavigations { get; set; }

Property Value

ISet<RuntimeSkipNavigation>

Methods

AddNavigation(RuntimeNavigation, bool)

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.

[EntityFrameworkInternal]
public virtual void AddNavigation(RuntimeNavigation navigation, bool onDependent)

Parameters

navigation RuntimeNavigation
onDependent bool

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.