ReferenceOwnershipBuilder.HasPrincipalKey(String[]) Method

Definition

Configures the unique property(s) that this relationship targets--that is, on the owner entity type. 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.ReferenceOwnershipBuilder HasPrincipalKey (params string[] keyPropertyNames);
abstract member HasPrincipalKey : string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder
override this.HasPrincipalKey : string[] -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceOwnershipBuilder
Public Overridable Function HasPrincipalKey (ParamArray keyPropertyNames As String()) As ReferenceOwnershipBuilder

Parameters

keyPropertyNames
String[]

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

Returns

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

Remarks

If multiple principal key properties are specified, the order of principal key properties should match the order that the primary key or unique constraint properties were configured on the principal entity type.

Applies to