IForeignKey Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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 IForeignKey : Microsoft.EntityFrameworkCore.Infrastructure.IAnnotatable
public interface IForeignKey : Microsoft.EntityFrameworkCore.Infrastructure.IAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyForeignKey
type IForeignKey = interface
interface IAnnotatable
type IForeignKey = interface
interface IReadOnlyForeignKey
interface IReadOnlyAnnotatable
interface IAnnotatable
Public Interface IForeignKey
Implements IAnnotatable
Public Interface IForeignKey
Implements IAnnotatable, IReadOnlyForeignKey
- 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 or sets a value indicating whether this relationship defines an ownership.
If |
IsRequired |
Gets a value indicating whether the principal entity is required.
If |
IsRequiredDependent |
Gets a value indicating whether the dependent entity is required.
If |
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 |
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
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 |
FindRuntimeAnnotation(String) |
Gets the runtime annotation with the given name, returning |
FindRuntimeAnnotationValue(String) |
Gets the value of the runtime annotation with the given name, returning |
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. |
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. |
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) |
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) |
RemoveRuntimeAnnotation(String) |
Removes the given runtime annotation from this object. (Inherited from 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 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. |
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(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. |
Relational(IForeignKey) |
Gets the relational database specific metadata for a foreign key. |
GetFluentApiCalls(IForeignKey, IAnnotationCodeGenerator, Boolean) |
Gets the fluent API calls to configure a foreign key. |
Sqlite(IForeignKey) |
Gets the SQLite specific metadata for a foreign key. |
SqlServer(IForeignKey) |
Gets the SQL Server specific metadata for a foreign key. |
Applies to
Entity Framework