Class RelationalKeyBuilderExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
Relational database specific extension methods for Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder.
public static class RelationalKeyBuilderExtensions
- Inheritance
-
RelationalKeyBuilderExtensions
- Inherited Members
Methods
CanSetName(IConventionKeyBuilder, string, bool)
Returns a value indicating whether the given name can be set for the key constraint.
public static bool CanSetName(this IConventionKeyBuilder keyBuilder, string name, bool fromDataAnnotation = false)
Parameters
keyBuilder
IConventionKeyBuilderThe builder for the key being configured.
name
stringThe name of the index.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
HasName(IConventionKeyBuilder, string, bool)
Configures the name of the key constraint in the database when targeting a relational database.
public static IConventionKeyBuilder HasName(this IConventionKeyBuilder keyBuilder, string name, bool fromDataAnnotation = false)
Parameters
keyBuilder
IConventionKeyBuilderThe builder for the key being configured.
name
stringThe name of the key.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionKeyBuilder
The same builder instance if the configuration was applied, null otherwise.
HasName(KeyBuilder, string)
Configures the name of the key constraint in the database when targeting a relational database.
public static KeyBuilder HasName(this KeyBuilder keyBuilder, string name)
Parameters
keyBuilder
KeyBuilderThe builder for the key being configured.
name
stringThe name of the key.
Returns
- KeyBuilder
The same builder instance so that multiple calls can be chained.
HasName<TEntity>(KeyBuilder<TEntity>, string)
Configures the name of the key constraint in the database when targeting a relational database.
public static KeyBuilder<TEntity> HasName<TEntity>(this KeyBuilder<TEntity> keyBuilder, string name)
Parameters
keyBuilder
KeyBuilder<TEntity>The builder for the key being configured.
name
stringThe name of the key.
Returns
- KeyBuilder<TEntity>
The same builder instance so that multiple calls can be chained.
Type Parameters
TEntity