Class RelationalForeignKeyExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
Extension methods for Microsoft.EntityFrameworkCore.Metadata.IForeignKey for relational database metadata.
public static class RelationalForeignKeyExtensions
- Inheritance
-
RelationalForeignKeyExtensions
- Inherited Members
Methods
FindSharedObjectRootForeignKey(IConventionForeignKey, in StoreObjectIdentifier)
Finds the first Microsoft.EntityFrameworkCore.Metadata.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.
public static IConventionForeignKey FindSharedObjectRootForeignKey(this IConventionForeignKey foreignKey, in StoreObjectIdentifier storeObject)
Parameters
foreignKey
IConventionForeignKeyThe foreign key.
storeObject
StoreObjectIdentifierThe identifier of the containing store object.
Returns
- IConventionForeignKey
The foreign key if found, or null if none was found.
FindSharedObjectRootForeignKey(IForeignKey, in StoreObjectIdentifier)
Finds the first Microsoft.EntityFrameworkCore.Metadata.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.
public static IForeignKey FindSharedObjectRootForeignKey(this IForeignKey foreignKey, in StoreObjectIdentifier storeObject)
Parameters
foreignKey
IForeignKeyThe foreign key.
storeObject
StoreObjectIdentifierThe identifier of the containing store object.
Returns
- IForeignKey
The foreign key if found, or null if none was found.
FindSharedObjectRootForeignKey(IMutableForeignKey, in StoreObjectIdentifier)
Finds the first Microsoft.EntityFrameworkCore.Metadata.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.
public static IMutableForeignKey FindSharedObjectRootForeignKey(this IMutableForeignKey foreignKey, in StoreObjectIdentifier storeObject)
Parameters
foreignKey
IMutableForeignKeyThe foreign key.
storeObject
StoreObjectIdentifierThe identifier of the containing store object.
Returns
- IMutableForeignKey
The foreign key if found, or null if none was found.
GetConstraintName(IForeignKey)
Returns the foreign key constraint name.
public static string GetConstraintName(this IForeignKey foreignKey)
Parameters
foreignKey
IForeignKeyThe foreign key.
Returns
- string
The foreign key constraint name.
GetConstraintName(IForeignKey, in StoreObjectIdentifier, in StoreObjectIdentifier)
Returns the foreign key constraint name.
public static string GetConstraintName(this IForeignKey foreignKey, in StoreObjectIdentifier storeObject, in StoreObjectIdentifier principalStoreObject)
Parameters
foreignKey
IForeignKeyThe foreign key.
storeObject
StoreObjectIdentifierThe identifier of the containing store object.
principalStoreObject
StoreObjectIdentifierThe identifier of the principal store object.
Returns
- string
The foreign key constraint name.
GetConstraintNameConfigurationSource(IConventionForeignKey)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the constraint name.
public static ConfigurationSource? GetConstraintNameConfigurationSource(this IConventionForeignKey foreignKey)
Parameters
foreignKey
IConventionForeignKeyThe foreign key.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the constraint name.
GetDefaultName(IForeignKey)
Returns the default constraint name that would be used for this foreign key.
public static string GetDefaultName(this IForeignKey foreignKey)
Parameters
foreignKey
IForeignKeyThe foreign key.
Returns
- string
The default constraint name that would be used for this foreign key.
GetDefaultName(IForeignKey, in StoreObjectIdentifier, in StoreObjectIdentifier)
Returns the default constraint name that would be used for this foreign key.
public static string GetDefaultName(this IForeignKey foreignKey, in StoreObjectIdentifier storeObject, in StoreObjectIdentifier principalStoreObject)
Parameters
foreignKey
IForeignKeyThe foreign key.
storeObject
StoreObjectIdentifierThe identifier of the containing store object.
principalStoreObject
StoreObjectIdentifierThe identifier of the principal store object.
Returns
- string
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.
public static IEnumerable<IForeignKeyConstraint> GetMappedConstraints(this IForeignKey foreignKey)
Parameters
foreignKey
IForeignKeyThe foreign key.
Returns
- IEnumerable<IForeignKeyConstraint>
The foreign key constraints to which the foreign key is mapped.
SetConstraintName(IConventionForeignKey, string, bool)
Sets the foreign key constraint name.
public static string SetConstraintName(this IConventionForeignKey foreignKey, string value, bool fromDataAnnotation = false)
Parameters
foreignKey
IConventionForeignKeyThe foreign key.
value
stringThe value to set.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- string
The configured name.
SetConstraintName(IMutableForeignKey, string)
Sets the foreign key constraint name.
public static void SetConstraintName(this IMutableForeignKey foreignKey, string value)
Parameters
foreignKey
IMutableForeignKeyThe foreign key.
value
stringThe value to set.