RelationalKeyBuilderExtensions.HasName Method

Definition

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)

Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs

Configures the name of the key constraint in the database when targeting a relational database.

C#
public static Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder HasName (this Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder keyBuilder, string name);
C#
public static Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder HasName (this Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder keyBuilder, string? name);

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

Entity Framework Core 9.0 ja muud versioonid
Toode Versioonid
Entity Framework Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

HasName(IConventionKeyBuilder, String, Boolean)

Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs

Configures the name of the key constraint in the database when targeting a relational database.

C#
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder HasName (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder keyBuilder, string name, bool fromDataAnnotation = false);
C#
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder? HasName (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionKeyBuilder keyBuilder, string? name, bool fromDataAnnotation = false);

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

Entity Framework Core 9.0 ja muud versioonid
Toode Versioonid
Entity Framework Core 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

HasName<TEntity>(KeyBuilder<TEntity>, String)

Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs
Source:
RelationalKeyBuilderExtensions.cs

Configures the name of the key constraint in the database when targeting a relational database.

C#
public static Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<TEntity> HasName<TEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<TEntity> keyBuilder, string name);
C#
public static Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<TEntity> HasName<TEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.KeyBuilder<TEntity> keyBuilder, string? name);

Type Parameters

TEntity

Parameters

keyBuilder
KeyBuilder<TEntity>

The builder for the key being configured.

name
String

The name of the key.

Returns

KeyBuilder<TEntity>

The same builder instance so that multiple calls can be chained.

Remarks

See Keys for more information and examples.

Applies to

Entity Framework Core 9.0 ja muud versioonid
Toode Versioonid
Entity Framework Core 5.0, 6.0, 7.0, 8.0, 9.0