RelationalKeyBuilderExtensions.HasName Method
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.
Overloads
HasName(KeyBuilder, String) |
Configures the name of the key constraint in the database when targeting a relational database. |
HasName(IConventionKeyBuilder, String, Boolean) |
Configures the name of the key constraint in the database when targeting a relational database. |
HasName<TEntity>(KeyBuilder<TEntity>, String) |
Configures the name of the key constraint in the database when targeting a relational database. |
HasName(KeyBuilder, String)
Configures the name of the key constraint in the database when targeting a relational database.
public static Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder HasName (this Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder keyBuilder, string name);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder HasName (this Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder keyBuilder, string? name);
static member HasName : Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder
<Extension()>
Public Function HasName (keyBuilder As KeyBuilder, name As String) As KeyBuilder
Parameters
- keyBuilder
- KeyBuilder
The builder for the key being configured.
- name
- String
The name of the key.
Returns
The same builder instance so that multiple calls can be chained.
Remarks
See Keys for more information and examples.
Applies to
HasName(IConventionKeyBuilder, String, Boolean)
Configures the name of the key constraint in the database when targeting a relational database.
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder HasName (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder keyBuilder, string name, bool fromDataAnnotation = false);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder? HasName (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder keyBuilder, string? name, bool fromDataAnnotation = false);
static member HasName : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder * string * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder
<Extension()>
Public Function HasName (keyBuilder As IConventionKeyBuilder, name As String, Optional fromDataAnnotation As Boolean = false) As IConventionKeyBuilder
Parameters
- keyBuilder
- IConventionKeyBuilder
The builder for the key being configured.
- name
- String
The name of the key.
- fromDataAnnotation
- Boolean
Indicates whether the configuration was specified using a data annotation.
Returns
The same builder instance if the configuration was applied,
null
otherwise.
Remarks
See Keys for more information and examples.
Applies to
HasName<TEntity>(KeyBuilder<TEntity>, String)
Configures the name of the key constraint in the database when targeting a relational database.
public static Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<TEntity> HasName<TEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<TEntity> keyBuilder, string name);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<TEntity> HasName<TEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<TEntity> keyBuilder, string? name);
static member HasName : Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<'Entity> * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<'Entity>
<Extension()>
Public Function HasName(Of TEntity) (keyBuilder As KeyBuilder(Of TEntity), name As String) As KeyBuilder(Of TEntity)
Type Parameters
- TEntity
Parameters
- keyBuilder
- KeyBuilder<TEntity>
The builder for the key being configured.
- name
- String
The name of the key.
Returns
The same builder instance so that multiple calls can be chained.
Remarks
See Keys for more information and examples.
Applies to
Entity Framework