IConventionForeignKey Interface

Definition

Represents a relationship where a foreign key property(s) in a dependent entity type reference a corresponding primary or alternate key in a principal entity type.

This interface is used during model creation and allows the metadata to be modified. Once the model is built, IForeignKey represents a read-only view of the same metadata.

public interface IConventionForeignKey : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IForeignKey
type IConventionForeignKey = interface
    interface IForeignKey
    interface IAnnotatable
    interface IConventionAnnotatable
Public Interface IConventionForeignKey
Implements IConventionAnnotatable, IForeignKey
Implements

Properties

Builder

Gets the builder that can be used to configure this foreign key.

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.

(Inherited from IForeignKey)
DependentToPrincipal

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

IsOwnership

Gets or sets 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.

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

(Inherited from IForeignKey)
IsRequiredDependent

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

(Inherited from IForeignKey)
IsUnique

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

(Inherited from IForeignKey)
Item[String]

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

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

AddAnnotation(String, Object, Boolean)

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

(Inherited from IConventionAnnotatable)
FindAnnotation(String)

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

(Inherited from IConventionAnnotatable)
GetAnnotations()

Gets all annotations on the current object.

(Inherited from IConventionAnnotatable)
GetConfigurationSource()

Returns the configuration source for this property.

GetDeleteBehaviorConfigurationSource()

Returns the configuration source for DeleteBehavior.

GetDependentToPrincipalConfigurationSource()

Returns the configuration source for DependentToPrincipal.

GetIsOwnershipConfigurationSource()

Returns the configuration source for IsOwnership.

GetIsRequiredConfigurationSource()

Returns the configuration source for IsRequired.

GetIsRequiredDependentConfigurationSource()

Returns the configuration source for IsRequiredDependent.

GetIsUniqueConfigurationSource()

Returns the configuration source for IsUnique.

GetPrincipalEndConfigurationSource()

Returns the configuration source for PrincipalEntityType.

GetPrincipalKeyConfigurationSource()

Returns the configuration source for PrincipalKey.

GetPrincipalToDependentConfigurationSource()

Returns the configuration source for PrincipalToDependent.

GetPropertiesConfigurationSource()

Returns the configuration source for Properties.

GetReferencingSkipNavigations()

Gets all skip navigations using this foreign key.

HasDependentToPrincipal(MemberInfo, Boolean)
Obsolete.

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

HasDependentToPrincipal(String, Boolean)
Obsolete.

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

HasPrincipalToDependent(MemberInfo, Boolean)
Obsolete.

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

HasPrincipalToDependent(String, Boolean)
Obsolete.

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

RemoveAnnotation(String)

Removes the annotation with the given name from this object.

(Inherited from IConventionAnnotatable)
SetAnnotation(String, Object, Boolean)

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

(Inherited from IConventionAnnotatable)
SetDeleteBehavior(Nullable<DeleteBehavior>, Boolean)

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

SetDependentToPrincipal(MemberInfo, Boolean)

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

SetDependentToPrincipal(String, Boolean)

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

SetIsOwnership(Nullable<Boolean>, Boolean)

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

SetIsRequired(Nullable<Boolean>, Boolean)

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

SetIsRequiredDependent(Nullable<Boolean>, Boolean)

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

SetIsUnique(Nullable<Boolean>, Boolean)

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

SetPrincipalToDependent(MemberInfo, Boolean)

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

SetPrincipalToDependent(String, Boolean)

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

SetProperties(IReadOnlyList<IConventionProperty>, IConventionKey, Boolean)

Sets the foreign key properties and that target principal key.

Extension Methods

AddAnnotations(IConventionAnnotatable, IEnumerable<IConventionAnnotation>, Boolean)

Adds annotations to an object.

GetAnnotation(IConventionAnnotatable, String)

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

SetOrRemoveAnnotation(IConventionAnnotatable, String, Object, Boolean)

Sets the annotation stored under the given name. Overwrites the existing annotation if an annotation with the specified name already exists. Removes the existing annotation if null is supplied.

GetNavigation(IConventionForeignKey, Boolean)

Returns a navigation associated with this foreign key.

GetRelatedEntityType(IConventionForeignKey, IConventionEntityType)

Gets the entity type related to the given one.

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.

GetAnnotation(IAnnotatable, String)

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

FindSharedObjectRootForeignKey(IConventionForeignKey, StoreObjectIdentifier)

Finds the first IConventionForeignKey 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(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.

GetConstraintName(IForeignKey)

Returns the foreign key constraint name.

GetConstraintName(IForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

Returns the foreign key constraint name.

GetConstraintNameConfigurationSource(IConventionForeignKey)

Gets the ConfigurationSource for the constraint name.

GetDefaultName(IForeignKey)

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

GetDefaultName(IForeignKey, StoreObjectIdentifier, StoreObjectIdentifier)

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.

SetConstraintName(IConventionForeignKey, String, Boolean)

Sets the foreign key constraint name.

Applies to