Class RelationalKeyExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
Extension methods for Microsoft.EntityFrameworkCore.Metadata.IKey for relational database metadata.
public static class RelationalKeyExtensions
- Inheritance
-
RelationalKeyExtensions
- Inherited Members
Methods
FindSharedObjectRootKey(IConventionKey, in StoreObjectIdentifier)
Finds the first Microsoft.EntityFrameworkCore.Metadata.IConventionKey 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 IConventionKey FindSharedObjectRootKey(this IConventionKey key, in StoreObjectIdentifier storeObject)
Parameters
key
IConventionKeyThe key.
storeObject
StoreObjectIdentifierThe identifier of the containing store object.
Returns
- IConventionKey
The key found, or null if none was found.
FindSharedObjectRootKey(IKey, in StoreObjectIdentifier)
Finds the first Microsoft.EntityFrameworkCore.Metadata.IKey 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 IKey FindSharedObjectRootKey(this IKey key, in StoreObjectIdentifier storeObject)
Parameters
key
IKeyThe key.
storeObject
StoreObjectIdentifierThe identifier of the containing store object.
Returns
- IKey
The key found, or null if none was found.
FindSharedObjectRootKey(IMutableKey, in StoreObjectIdentifier)
Finds the first Microsoft.EntityFrameworkCore.Metadata.IMutableKey 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 IMutableKey FindSharedObjectRootKey(this IMutableKey key, in StoreObjectIdentifier storeObject)
Parameters
key
IMutableKeyThe key.
storeObject
StoreObjectIdentifierThe identifier of the containing store object.
Returns
- IMutableKey
The key found, or null if none was found.
GetDefaultName(IKey)
Returns the default key constraint name that would be used for this key.
public static string GetDefaultName(this IKey key)
Parameters
key
IKeyThe key.
Returns
- string
The default key constraint name that would be used for this key.
GetDefaultName(IKey, in StoreObjectIdentifier)
Returns the default key constraint name that would be used for this key for a particular table.
public static string GetDefaultName(this IKey key, in StoreObjectIdentifier storeObject)
Parameters
key
IKeyThe key.
storeObject
StoreObjectIdentifierThe identifier of the containing store object.
Returns
- string
The default key constraint name that would be used for this key.
GetMappedConstraints(IKey)
Gets the unique constraints to which the key is mapped.
public static IEnumerable<IUniqueConstraint> GetMappedConstraints(this IKey key)
Parameters
key
IKeyThe key.
Returns
- IEnumerable<IUniqueConstraint>
The unique constraints to which the key is mapped.
GetName(IKey)
Returns the key constraint name for this key.
public static string GetName(this IKey key)
Parameters
key
IKeyThe key.
Returns
- string
The key constraint name for this key.
GetName(IKey, in StoreObjectIdentifier)
Returns the key constraint name for this key for a particular table.
public static string GetName(this IKey key, in StoreObjectIdentifier storeObject)
Parameters
key
IKeyThe key.
storeObject
StoreObjectIdentifierThe identifier of the containing store object.
Returns
- string
The key constraint name for this key.
GetNameConfigurationSource(IConventionKey)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the constraint name.
public static ConfigurationSource? GetNameConfigurationSource(this IConventionKey key)
Parameters
key
IConventionKeyThe key.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the constraint name.
SetName(IConventionKey, string, bool)
Sets the key constraint name for this key.
public static string SetName(this IConventionKey key, string name, bool fromDataAnnotation = false)
Parameters
key
IConventionKeyThe key.
name
stringThe value to set.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- string
The configured name.
SetName(IMutableKey, string)
Sets the key constraint name for this key.
public static void SetName(this IMutableKey key, string name)
Parameters
key
IMutableKeyThe key.
name
stringThe value to set.