RelationalForeignKeyBuilderExtensions.HasConstraintName 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
HasConstraintName(OwnershipBuilder, String) |
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。 |
HasConstraintName(ReferenceCollectionBuilder, String) |
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。 |
HasConstraintName(ReferenceReferenceBuilder, String) |
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。 |
HasConstraintName(IConventionForeignKeyBuilder, String, Boolean) |
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。 |
HasConstraintName(IConventionRelationshipBuilder, String, Boolean) |
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。 |
HasConstraintName<TEntity,TDependentEntity>(OwnershipBuilder<TEntity,TDependentEntity>, String) |
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。 |
HasConstraintName<TEntity,TRelatedEntity>(ReferenceCollectionBuilder<TEntity,TRelatedEntity>, String) |
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。 |
HasConstraintName<TEntity,TRelatedEntity>(ReferenceReferenceBuilder<TEntity,TRelatedEntity>, String) |
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。 |
HasConstraintName(OwnershipBuilder, String)
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。
public static Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder ownershipBuilder, string name);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder ownershipBuilder, string? name);
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder
<Extension()>
Public Function HasConstraintName (ownershipBuilder As OwnershipBuilder, name As String) As OwnershipBuilder
參數
- ownershipBuilder
- OwnershipBuilder
用來設定關聯性的產生器。
- name
- String
外鍵條件約束的名稱。
傳回
相同的產生器實例,以便鏈結多個呼叫。
備註
如需詳細資訊和範例,請參閱 模型化實體類型和關聯 性。
適用於
HasConstraintName(ReferenceCollectionBuilder, String)
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。
public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder referenceCollectionBuilder, string name);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder referenceCollectionBuilder, string? name);
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder
<Extension()>
Public Function HasConstraintName (referenceCollectionBuilder As ReferenceCollectionBuilder, name As String) As ReferenceCollectionBuilder
參數
- referenceCollectionBuilder
- ReferenceCollectionBuilder
用來設定關聯性的產生器。
- name
- String
外鍵條件約束的名稱。
傳回
相同的產生器實例,以便鏈結多個呼叫。
備註
如需詳細資訊和範例,請參閱 模型化實體類型和關聯 性。
適用於
HasConstraintName(ReferenceReferenceBuilder, String)
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。
public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder referenceReferenceBuilder, string name);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder referenceReferenceBuilder, string? name);
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder
<Extension()>
Public Function HasConstraintName (referenceReferenceBuilder As ReferenceReferenceBuilder, name As String) As ReferenceReferenceBuilder
參數
- referenceReferenceBuilder
- ReferenceReferenceBuilder
用來設定關聯性的產生器。
- name
- String
外鍵條件約束的名稱。
傳回
相同的產生器實例,以便鏈結多個呼叫。
備註
如需詳細資訊和範例,請參閱 模型化實體類型和關聯 性。
適用於
HasConstraintName(IConventionForeignKeyBuilder, String, Boolean)
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder relationship, string name, bool fromDataAnnotation = false);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder? HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder relationship, string? name, bool fromDataAnnotation = false);
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder * string * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder
<Extension()>
Public Function HasConstraintName (relationship As IConventionForeignKeyBuilder, name As String, Optional fromDataAnnotation As Boolean = false) As IConventionForeignKeyBuilder
參數
- relationship
- IConventionForeignKeyBuilder
用來設定關聯性的產生器。
- name
- String
外鍵條件約束的名稱。
- fromDataAnnotation
- Boolean
指出是否使用資料批註來指定組態。
傳回
如果套用組態,則為相同的產生器實例, null
否則為 。
備註
如需詳細資訊和範例,請參閱 模型化實體類型和關聯 性。
適用於
HasConstraintName(IConventionRelationshipBuilder, String, Boolean)
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder relationship, string name, bool fromDataAnnotation = false);
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder * string * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder
<Extension()>
Public Function HasConstraintName (relationship As IConventionRelationshipBuilder, name As String, Optional fromDataAnnotation As Boolean = false) As IConventionRelationshipBuilder
參數
- relationship
- IConventionRelationshipBuilder
用來設定關聯性的產生器。
- name
- String
外鍵條件約束的名稱。
- fromDataAnnotation
- Boolean
指出是否使用資料批註來指定組態。
傳回
如果套用組態,則為相同的產生器實例, null
否則為 。
適用於
HasConstraintName<TEntity,TDependentEntity>(OwnershipBuilder<TEntity,TDependentEntity>, String)
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。
public static Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<TEntity,TDependentEntity> HasConstraintName<TEntity,TDependentEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<TEntity,TDependentEntity> ownershipBuilder, string name) where TEntity : class where TDependentEntity : class;
public static Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<TEntity,TDependentEntity> HasConstraintName<TEntity,TDependentEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<TEntity,TDependentEntity> ownershipBuilder, string? name) where TEntity : class where TDependentEntity : class;
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)> * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)> (requires 'Entity : null and 'DependentEntity : null)
<Extension()>
Public Function HasConstraintName(Of TEntity As Class, TDependentEntity As Class) (ownershipBuilder As OwnershipBuilder(Of TEntity, TDependentEntity), name As String) As OwnershipBuilder(Of TEntity, TDependentEntity)
類型參數
- TEntity
關聯性一端的實體類型。
- TDependentEntity
關聯性另一端的實體類型。
參數
- ownershipBuilder
- OwnershipBuilder<TEntity,TDependentEntity>
用來設定關聯性的產生器。
- name
- String
外鍵條件約束的名稱。
傳回
相同的產生器實例,以便鏈結多個呼叫。
備註
如需詳細資訊和範例,請參閱 模型化實體類型和關聯 性。
適用於
HasConstraintName<TEntity,TRelatedEntity>(ReferenceCollectionBuilder<TEntity,TRelatedEntity>, String)
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。
public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TEntity,TRelatedEntity> HasConstraintName<TEntity,TRelatedEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TEntity,TRelatedEntity> referenceCollectionBuilder, string name) where TEntity : class where TRelatedEntity : class;
public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TEntity,TRelatedEntity> HasConstraintName<TEntity,TRelatedEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TEntity,TRelatedEntity> referenceCollectionBuilder, string? name) where TEntity : class where TRelatedEntity : class;
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'Entity : null and 'RelatedEntity : null)
<Extension()>
Public Function HasConstraintName(Of TEntity As Class, TRelatedEntity As Class) (referenceCollectionBuilder As ReferenceCollectionBuilder(Of TEntity, TRelatedEntity), name As String) As ReferenceCollectionBuilder(Of TEntity, TRelatedEntity)
類型參數
- TEntity
此關聯性中的主體實體類型。
- TRelatedEntity
此關聯性中的相依實體類型。
參數
- referenceCollectionBuilder
- ReferenceCollectionBuilder<TEntity,TRelatedEntity>
用來設定關聯性的產生器。
- name
- String
外鍵條件約束的名稱。
傳回
相同的產生器實例,以便鏈結多個呼叫。
備註
如需詳細資訊和範例,請參閱 模型化實體類型和關聯 性。
適用於
HasConstraintName<TEntity,TRelatedEntity>(ReferenceReferenceBuilder<TEntity,TRelatedEntity>, String)
以關係資料庫為目標時,設定此關聯性的外鍵條件約束名稱。
public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> HasConstraintName<TEntity,TRelatedEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> referenceReferenceBuilder, string name) where TEntity : class where TRelatedEntity : class;
public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> HasConstraintName<TEntity,TRelatedEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> referenceReferenceBuilder, string? name) where TEntity : class where TRelatedEntity : class;
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'Entity : null and 'RelatedEntity : null)
<Extension()>
Public Function HasConstraintName(Of TEntity As Class, TRelatedEntity As Class) (referenceReferenceBuilder As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity), name As String) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)
類型參數
- TEntity
關聯性一端的實體類型。
- TRelatedEntity
關聯性另一端的實體類型。
參數
- referenceReferenceBuilder
- ReferenceReferenceBuilder<TEntity,TRelatedEntity>
用來設定關聯性的產生器。
- name
- String
外鍵條件約束的名稱。
傳回
相同的產生器實例,以便鏈結多個呼叫。
備註
如需詳細資訊和範例,請參閱 模型化實體類型和關聯 性。