RelationalKeyBuilderExtensions.HasName 方法

定义

重载

HasName(KeyBuilder, String)

以关系数据库为目标时,配置数据库中键约束的名称。

HasName(IConventionKeyBuilder, String, Boolean)

以关系数据库为目标时,配置数据库中键约束的名称。

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

以关系数据库为目标时,配置数据库中键约束的名称。

HasName(KeyBuilder, String)

以关系数据库为目标时,配置数据库中键约束的名称。

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

参数

keyBuilder
KeyBuilder

要配置的密钥的生成器。

name
String

键的名称。

返回

同一生成器实例,以便可以链接多个调用。

注解

有关详细信息和示例,请参阅 密钥

适用于

HasName(IConventionKeyBuilder, String, Boolean)

以关系数据库为目标时,配置数据库中键约束的名称。

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

参数

keyBuilder
IConventionKeyBuilder

要配置的密钥的生成器。

name
String

键的名称。

fromDataAnnotation
Boolean

指示配置是否是使用数据注释指定的。

返回

如果应用了配置,则为同一生成器实例, null 否则为 。

注解

有关详细信息和示例,请参阅 密钥

适用于

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

以关系数据库为目标时,配置数据库中键约束的名称。

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)

类型参数

TEntity

参数

keyBuilder
KeyBuilder<TEntity>

要配置的密钥的生成器。

name
String

键的名称。

返回

KeyBuilder<TEntity>

同一生成器实例,以便可以链接多个调用。

注解

有关详细信息和示例,请参阅 密钥

适用于