共用方式為


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>

相同的產生器實例,以便鏈結多個呼叫。

備註

如需詳細資訊和範例,請參閱 金鑰

適用於