Share via


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

public interface IMutableForeignKey : Microsoft.EntityFrameworkCore.Metadata.IForeignKey, Microsoft.EntityFrameworkCore.Metadata.IMutableAnnotatable
public interface IMutableForeignKey : Microsoft.EntityFrameworkCore.Metadata.IMutableAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyForeignKey
type IMutableForeignKey = interface
    interface IForeignKey
    interface IAnnotatable
    interface IMutableAnnotatable
type IMutableForeignKey = interface
    interface IReadOnlyForeignKey
    interface IReadOnlyAnnotatable
    interface IMutableAnnotatable
Public Interface IMutableForeignKey
Implements IForeignKey, IMutableAnnotatable
Public Interface IMutableForeignKey
Implements IMutableAnnotatable, IReadOnlyForeignKey
Implements

Remarks

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.

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

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 ownership. If true, the dependent entity must always be accessed via the navigation from the principal entity.

IsRequired

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

IsRequiredDependent

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

IsUnique

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

AddAnnotation(String, Object)

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

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

Adds annotations to an object.

(Inherited from IMutableAnnotatable)
AddRuntimeAnnotation(String, Object)

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

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

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

(Inherited from IAnnotatable)
FindRuntimeAnnotationValue(String)

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

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

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

(Inherited from IForeignKey)
GetNavigation(Boolean)

Returns a navigation associated with this foreign key.

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 IAnnotatable)
GetReferencingSkipNavigations()

Gets all skip navigations using this foreign key.

GetRelatedEntityType(IReadOnlyEntityType)

Gets the entity type related to the given one.

GetRuntimeAnnotations()

Gets all the runtime annotations on the current object.

(Inherited from IAnnotatable)
HasDependentToPrincipal(MemberInfo)
Obsolete.

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

HasDependentToPrincipal(PropertyInfo)

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

HasDependentToPrincipal(String)
Obsolete.

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

HasPrincipalToDependent(MemberInfo)
Obsolete.

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

HasPrincipalToDependent(PropertyInfo)

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

HasPrincipalToDependent(String)
Obsolete.

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

IsBaseLinking()

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

(Inherited from IReadOnlyForeignKey)
RemoveAnnotation(String)

Removes the given annotation from this object.

(Inherited from IMutableAnnotatable)
RemoveRuntimeAnnotation(String)

Removes the given runtime annotation from this object.

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

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

SetDependentToPrincipal(String)

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

SetOrRemoveAnnotation(String, Object)

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.

(Inherited from IMutableAnnotatable)
SetPrincipalToDependent(MemberInfo)

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

SetPrincipalToDependent(String)

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

SetProperties(IReadOnlyList<IMutableProperty>, IMutableKey)

Sets the foreign key properties and that target principal key.

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

(Inherited from IReadOnlyForeignKey)

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.

GetAnnotation(IAnnotatable, String)

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

AddAnnotations(IMutableAnnotatable, IEnumerable<IAnnotation>)

Adds annotations to an object.

GetAnnotation(IMutableAnnotatable, String)

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

GetOrAddAnnotation(IMutableAnnotatable, String, String)

Gets the existing annotation with a given key, or adds a new annotation if one does not exist.

SetOrRemoveAnnotation(IMutableAnnotatable, String, Object)

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(IMutableForeignKey, Boolean)

Returns a navigation associated with this foreign key.

GetRelatedEntityType(IMutableForeignKey, IMutableEntityType)

Gets the entity type related to the given one.

FindSharedObjectRootForeignKey(IForeignKey, 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(IMutableForeignKey, StoreObjectIdentifier)

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

SetConstraintName(IMutableForeignKey, String)

Sets the foreign key constraint name.

Relational(IForeignKey)

Gets the relational database specific metadata for a foreign key.

Relational(IMutableForeignKey)

Gets the relational database specific metadata for a foreign key.

Sqlite(IForeignKey)

Gets the SQLite specific metadata for a foreign key.

Sqlite(IMutableForeignKey)

Gets the SQLite specific metadata for a foreign key.

SqlServer(IForeignKey)

Gets the SQL Server specific metadata for a foreign key.

SqlServer(IMutableForeignKey)

Gets the SQL Server specific metadata for a foreign key.

Applies to