Share via


ReferenceCollectionBuilder<TPrincipalEntity,TDependentEntity>.HasPrincipalKey Method

Definition

Overloads

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

Configures the unique property(s) that this relationship targets. Typically you would only call this method if you want to use a property(s) other than the primary key as the principal property(s). If the specified property(s) is not already a unique constraint (or the primary key) then a new unique constraint will be introduced.

HasPrincipalKey(String[])

Configures the unique property(s) that this relationship targets. Typically you would only call this method if you want to use a property(s) other than the primary key as the principal property(s). If the specified property(s) is not already a unique constraint (or the primary key) then a new unique constraint will be introduced.

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

Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs

Configures the unique property(s) that this relationship targets. Typically you would only call this method if you want to use a property(s) other than the primary key as the principal property(s). If the specified property(s) is not already a unique constraint (or the primary key) then a new unique constraint will be introduced.

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

Parameters

keyExpression
Expression<Func<TPrincipalEntity,Object>>

A lambda expression representing the referenced key property(s) (blog => blog.BlogId).

If the principal key is made up of multiple properties then specify an anonymous type including the properties (t => new { t.Id1, t.Id2 }). The order specified should match the order of corresponding properties in HasForeignKey(Expression<Func<TDependentEntity,Object>>).

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to

HasPrincipalKey(String[])

Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs
Source:
ReferenceCollectionBuilder%60.cs

Configures the unique property(s) that this relationship targets. Typically you would only call this method if you want to use a property(s) other than the primary key as the principal property(s). If the specified property(s) is not already a unique constraint (or the primary key) then a new unique constraint will be introduced.

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

Parameters

keyPropertyNames
String[]

The name(s) of the referenced key property(s).

Returns

The same builder instance so that multiple configuration calls can be chained.

Applies to