ReferenceReferenceBuilder<TEntity,TRelatedEntity>.HasPrincipalKey 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| HasPrincipalKey(String, String[]) |
配置此關係所針對的獨特屬性。 通常只有當你想使用主鍵以外的屬性作為主要屬性時,才會呼叫此方法。 若指定的屬性尚未是唯一限制(或主鍵),則會引入新的唯一限制。 |
| HasPrincipalKey(Type, String[]) |
配置此關係所針對的獨特屬性。 通常只有當你想使用主鍵以外的屬性作為主要屬性時,才會呼叫此方法。 若指定的屬性尚未是唯一限制(或主鍵),則會引入新的唯一限制。 |
| HasPrincipalKey<TPrincipalEntity>(Expression<Func<TPrincipalEntity,Object>>) |
配置此關係所針對的獨特屬性。 通常只有當你想使用主鍵以外的屬性作為主要屬性時,才會呼叫此方法。 若指定的屬性尚未是唯一限制(或主鍵),則會引入新的唯一限制。 |
| HasPrincipalKey<TPrincipalEntity>(String[]) |
配置此關係所針對的獨特屬性。 通常只有當你想使用主鍵以外的屬性作為主要屬性時,才會呼叫此方法。 若指定的屬性尚未是唯一限制(或主鍵),則會引入新的唯一限制。 |
HasPrincipalKey(String, String[])
配置此關係所針對的獨特屬性。 通常只有當你想使用主鍵以外的屬性作為主要屬性時,才會呼叫此方法。 若指定的屬性尚未是唯一限制(或主鍵),則會引入新的唯一限制。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> HasPrincipalKey(string principalEntityTypeName, params string[] keyPropertyNames);
override this.HasPrincipalKey : string * string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)>
Public Overridable Function HasPrincipalKey (principalEntityTypeName As String, ParamArray keyPropertyNames As String()) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)
參數
- principalEntityTypeName
- String
在此關係中作為主體的實體類型名稱(具有參考金鑰屬性的類型)。
- keyPropertyNames
- String[]
參考金鑰屬性的名稱。
傳回
同一個建構器實例,這樣可以串接多個設定呼叫。
備註
若指定多個主鍵屬性,主鍵屬性的順序應與主鍵或唯一約束屬性在主實體類型上配置的順序相符。
適用於
HasPrincipalKey(Type, String[])
配置此關係所針對的獨特屬性。 通常只有當你想使用主鍵以外的屬性作為主要屬性時,才會呼叫此方法。 若指定的屬性尚未是唯一限制(或主鍵),則會引入新的唯一限制。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> HasPrincipalKey(Type principalEntityType, params string[] keyPropertyNames);
override this.HasPrincipalKey : Type * string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)>
Public Overridable Function HasPrincipalKey (principalEntityType As Type, ParamArray keyPropertyNames As String()) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)
參數
- principalEntityType
- Type
此關係中的主要實體類型(具有參考鍵屬性的類型)。
- keyPropertyNames
- String[]
參考金鑰屬性的名稱。
傳回
同一個建構器實例,這樣可以串接多個設定呼叫。
備註
若指定多個主鍵屬性,主鍵屬性的順序應與主鍵或唯一約束屬性在主實體類型上配置的順序相符。
適用於
HasPrincipalKey<TPrincipalEntity>(Expression<Func<TPrincipalEntity,Object>>)
配置此關係所針對的獨特屬性。 通常只有當你想使用主鍵以外的屬性作為主要屬性時,才會呼叫此方法。 若指定的屬性尚未是唯一限制(或主鍵),則會引入新的唯一限制。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> HasPrincipalKey<TPrincipalEntity>(System.Linq.Expressions.Expression<Func<TPrincipalEntity,object>> keyExpression);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> HasPrincipalKey<TPrincipalEntity>(System.Linq.Expressions.Expression<Func<TPrincipalEntity,object>> keyExpression) where TPrincipalEntity : class;
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> HasPrincipalKey<TPrincipalEntity>(System.Linq.Expressions.Expression<Func<TPrincipalEntity,object?>> keyExpression) where TPrincipalEntity : class;
override this.HasPrincipalKey : System.Linq.Expressions.Expression<Func<'PrincipalEntity, obj>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)>
override this.HasPrincipalKey : System.Linq.Expressions.Expression<Func<'PrincipalEntity, obj>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'PrincipalEntity : null)
Public Overridable Function HasPrincipalKey(Of TPrincipalEntity) (keyExpression As Expression(Of Func(Of TPrincipalEntity, Object))) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)
Public Overridable Function HasPrincipalKey(Of TPrincipalEntity As Class) (keyExpression As Expression(Of Func(Of TPrincipalEntity, Object))) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)
類型參數
- TPrincipalEntity
此關係中的主要實體類型。 也就是說,具有參考鍵屬性的型別。
參數
- keyExpression
- Expression<Func<TPrincipalEntity,Object>>
一個代表參考鍵屬性(t => t.Ids)的 lambda 表達式()。
若主鍵由多個屬性組成,則指定包含屬性(t => new { t.Id1, t.Id2 })的匿名型別。 指定的順序應與中 HasForeignKey<TDependentEntity>(Expression<Func<TDependentEntity,Object>>)對應屬性的順序相符。
傳回
同一個建構器實例,這樣可以串接多個設定呼叫。
備註
若指定多個主鍵屬性,主鍵屬性的順序應與主鍵或唯一約束屬性在主實體類型上配置的順序相符。
適用於
HasPrincipalKey<TPrincipalEntity>(String[])
配置此關係所針對的獨特屬性。 通常只有當你想使用主鍵以外的屬性作為主要屬性時,才會呼叫此方法。 若指定的屬性尚未是唯一限制(或主鍵),則會引入新的唯一限制。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> HasPrincipalKey<TPrincipalEntity>(params string[] keyPropertyNames) where TPrincipalEntity : class;
override this.HasPrincipalKey : string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'PrincipalEntity : null)
Public Overridable Function HasPrincipalKey(Of TPrincipalEntity As Class) (ParamArray keyPropertyNames As String()) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)
類型參數
- TPrincipalEntity
此關係中的主要實體類型(具有參考鍵屬性的類型)。
參數
- keyPropertyNames
- String[]
參考金鑰屬性的名稱。
傳回
同一個建構器實例,這樣可以串接多個設定呼叫。