Share via


IReadOnlyForeignKey Interface

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 interface IReadOnlyForeignKey : Microsoft.EntityFrameworkCore.Infrastructure.IReadOnlyAnnotatable
type IReadOnlyForeignKey = interface
    interface IReadOnlyAnnotatable
Public Interface IReadOnlyForeignKey
Implements IReadOnlyAnnotatable
Derived
Implements

Remarks

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

Properties

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

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.

DependentToPrincipal

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

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.

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.

IsRequiredDependent

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

IsUnique

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

Item[String]

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

(Inherited from IReadOnlyAnnotatable)
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.

PrincipalToDependent

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

Properties

Gets the foreign key properties in the dependent entity.

Methods

AnnotationsToDebugString(Int32)

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

(Inherited from IReadOnlyAnnotatable)
FindAnnotation(String)

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

(Inherited from IReadOnlyAnnotatable)
GetAnnotation(String)

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

(Inherited from IReadOnlyAnnotatable)
GetAnnotations()

Gets all annotations on the current object.

(Inherited from IReadOnlyAnnotatable)
GetNavigation(Boolean)

Returns a navigation associated with this foreign key.

GetReferencingSkipNavigations()

Gets the skip navigations using this foreign key.

GetRelatedEntityType(IReadOnlyEntityType)

Gets the entity type related to the given one.

IsBaseLinking()

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

ToDebugString(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.

Extension Methods

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(IReadOnlyForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

Returns the foreign key constraint name.

GetConstraintName(IReadOnlyForeignKey)

Returns the foreign key constraint name.

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.

IsRowInternal(IReadOnlyForeignKey, StoreObjectIdentifier)

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

Applies to