語言

OwnershipBuilder<TEntity,TDependentEntity>.HasPrincipalKey 方法

定義

多載

名稱 Description
HasPrincipalKey(Expression<Func<TEntity,Object>>)

配置此關係所針對的獨特屬性。 通常只有當你想使用主鍵以外的屬性作為主要屬性時,才會呼叫此方法。 若指定的屬性尚未是唯一限制(或主鍵),則會引入新的唯一限制。

HasPrincipalKey(String[])

配置此關係所針對的獨特屬性。 通常只有當你想使用主鍵以外的屬性作為主要屬性時,才會呼叫此方法。 若指定的屬性尚未是唯一限制(或主鍵),則會引入新的唯一限制。

HasPrincipalKey(Expression<Func<TEntity,Object>>)

來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs

配置此關係所針對的獨特屬性。 通常只有當你想使用主鍵以外的屬性作為主要屬性時,才會呼叫此方法。 若指定的屬性尚未是唯一限制(或主鍵),則會引入新的唯一限制。

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<TEntity,TDependentEntity> HasPrincipalKey(System.Linq.Expressions.Expression<Func<TEntity,object?>> keyExpression);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<TEntity,TDependentEntity> HasPrincipalKey(System.Linq.Expressions.Expression<Func<TEntity,object>> keyExpression);
override this.HasPrincipalKey : System.Linq.Expressions.Expression<Func<'Entity, obj>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)>
Public Overridable Function HasPrincipalKey (keyExpression As Expression(Of Func(Of TEntity, Object))) As OwnershipBuilder(Of TEntity, TDependentEntity)

參數

keyExpression
Expression<Func<TEntity,Object>>

一個代表參考鍵屬性(t => t.Ids)的 lambda 表達式()。

若主鍵由多個屬性組成,則指定包含屬性(t => new { t.Id1, t.Id2 })的匿名型別。 指定的順序應與中 HasForeignKey(Expression<Func<TDependentEntity,Object>>)對應屬性的順序相符。

傳回

同一個建構器實例,這樣可以串接多個設定呼叫。

適用於

HasPrincipalKey(String[])

來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs
來源:
OwnershipBuilder`.cs

配置此關係所針對的獨特屬性。 通常只有當你想使用主鍵以外的屬性作為主要屬性時,才會呼叫此方法。 若指定的屬性尚未是唯一限制(或主鍵),則會引入新的唯一限制。

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<TEntity,TDependentEntity> HasPrincipalKey(params string[] keyPropertyNames);
override this.HasPrincipalKey : string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)>
Public Overridable Function HasPrincipalKey (ParamArray keyPropertyNames As String()) As OwnershipBuilder(Of TEntity, TDependentEntity)

參數

keyPropertyNames
String[]

參考金鑰屬性的名稱。

傳回

同一個建構器實例,這樣可以串接多個設定呼叫。

適用於