ReferenceReferenceBuilder ReferenceReferenceBuilder Class

Definition

Provides a simple API for configuring a one-to-one relationship.

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

public class ReferenceReferenceBuilder : IInfrastructure<IMutableModel>, IInfrastructure<InternalRelationshipBuilder>
Public Class ReferenceReferenceBuilder
    Implements IInfrastructure(Of IMutableModel), IInfrastructure(Of InternalRelationshipBuilder)
Inheritance
System.ObjectSystem.Object
ReferenceReferenceBuilderReferenceReferenceBuilder
Implements

Constructors

ReferenceReferenceBuilder(InternalRelationshipBuilder, EntityType, EntityType) ReferenceReferenceBuilder(InternalRelationshipBuilder, EntityType, EntityType)

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

public ReferenceReferenceBuilder(InternalRelationshipBuilder builder, EntityType declaringEntityType, EntityType relatedEntityType)
Public Sub New(builder As InternalRelationshipBuilder, declaringEntityType As EntityType, relatedEntityType As EntityType)
Parameters
declaringEntityType
EntityType EntityType
relatedEntityType
EntityType EntityType

ReferenceReferenceBuilder(InternalRelationshipBuilder, ReferenceReferenceBuilder, Boolean, Boolean, Boolean, Boolean) ReferenceReferenceBuilder(InternalRelationshipBuilder, ReferenceReferenceBuilder, Boolean, Boolean, Boolean, Boolean)

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

protected ReferenceReferenceBuilder(InternalRelationshipBuilder builder, ReferenceReferenceBuilder oldBuilder, bool inverted = false, bool foreignKeySet = false, bool principalKeySet = false, bool requiredSet = false)
Protected Sub New(builder As InternalRelationshipBuilder, oldBuilder As ReferenceReferenceBuilder, inverted As Boolean = False, foreignKeySet As Boolean = False, principalKeySet As Boolean = False, requiredSet As Boolean = False)
Parameters
inverted
System.Boolean System.Boolean
foreignKeySet
System.Boolean System.Boolean
principalKeySet
System.Boolean System.Boolean
requiredSet
System.Boolean System.Boolean

Properties

Builder Builder

Gets the internal builder being used to configure this relationship.

protected virtual InternalRelationshipBuilder Builder { get; }
Protected Overridable ReadOnly Property Builder As InternalRelationshipBuilder

Metadata Metadata

The foreign key that represents this relationship.

public virtual IMutableForeignKey Metadata { get; }
Public Overridable ReadOnly Property Metadata As IMutableForeignKey

Methods

Equals(Object) Equals(Object)

Inherited from System.Object

Equals(Object, Object) Equals(Object, Object)

Inherited from System.Object

GetHashCode() GetHashCode()

Inherited from System.Object

GetType() GetType()

Inherited from System.Object

HasAnnotation(String, Object) HasAnnotation(String, Object)

Adds or updates an annotation on the relationship. If an annotation with the key specified in annotation already exists it's value will be updated.

public virtual ReferenceReferenceBuilder HasAnnotation(string annotation, object value)
Public Overridable Function HasAnnotation(annotation As String, value As Object) As ReferenceReferenceBuilder
Parameters
annotation
System.String System.String

The key of the annotation to be added or updated.

value
System.Object System.Object

The value to be stored in the annotation.

Returns

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

HasForeignKey(String, String[]) HasForeignKey(String, String())

Configures the property(s) to use as the foreign key for this relationship.

If the specified property name(s) do not exist on the entity type then a new shadow state property(s) will be added to serve as the foreign key. A shadow state property is one that does not have a corresponding property in the entity class. The current value for the property is stored in the ChangeTracker rather than being stored in instances of the entity class.

If HasPrincipalKey(Type, String[]) is not specified, then an attempt will be made to match the data type and order of foreign key properties against the primary key of the principal entity type. If they do not match, new shadow state properties that form a unique index will be added to the principal entity type to serve as the reference key.

public virtual ReferenceReferenceBuilder HasForeignKey(string dependentEntityTypeName, params string[] foreignKeyPropertyNames)
Public Overridable Function HasForeignKey(dependentEntityTypeName As String, ParamArray foreignKeyPropertyNames As String()) As ReferenceReferenceBuilder
Parameters
dependentEntityTypeName
System.String System.String

The name of the entity type that is the dependent in this relationship (the type that has the foreign key properties).

foreignKeyPropertyNames
System.String[] System.String()

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

Returns

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

HasForeignKey(Type, String[]) HasForeignKey(Type, String())

Configures the property(s) to use as the foreign key for this relationship.

If the specified property name(s) do not exist on the entity type then a new shadow state property(s) will be added to serve as the foreign key. A shadow state property is one that does not have a corresponding property in the entity class. The current value for the property is stored in the ChangeTracker rather than being stored in instances of the entity class.

If HasPrincipalKey(Type, String[]) is not specified, then an attempt will be made to match the data type and order of foreign key properties against the primary key of the principal entity type. If they do not match, new shadow state properties that form a unique index will be added to the principal entity type to serve as the reference key.

public virtual ReferenceReferenceBuilder HasForeignKey(Type dependentEntityType, params string[] foreignKeyPropertyNames)
Public Overridable Function HasForeignKey(dependentEntityType As Type, ParamArray foreignKeyPropertyNames As String()) As ReferenceReferenceBuilder
Parameters
dependentEntityType
System.Type System.Type

The entity type that is the dependent in this relationship (the type that has the foreign key properties).

foreignKeyPropertyNames
System.String[] System.String()

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

Returns

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

HasForeignKey(String[]) HasForeignKey(Of TDependentEntity)(String())

Configures the property(s) to use as the foreign key for this relationship.

If the specified property name(s) do not exist on the entity type then a new shadow state property(s) will be added to serve as the foreign key. A shadow state property is one that does not have a corresponding property in the entity class. The current value for the property is stored in the ChangeTracker rather than being stored in instances of the entity class.

If HasPrincipalKey(Type, String[]) is not specified, then an attempt will be made to match the data type and order of foreign key properties against the primary key of the principal entity type. If they do not match, new shadow state properties that form a unique index will be added to the principal entity type to serve as the reference key.

public virtual ReferenceReferenceBuilder HasForeignKey<TDependentEntity>(params string[] foreignKeyPropertyNames)where TDependentEntity : class
Public Overridable Function HasForeignKey(Of TDependentEntity As Class)(ParamArray foreignKeyPropertyNames As String()) As ReferenceReferenceBuilder
Type Parameters
TDependentEntity

The entity type that is the dependent in this relationship (the type that has the foreign key properties).

Parameters
foreignKeyPropertyNames
System.String[] System.String()

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

Returns

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

HasForeignKeyBuilder(EntityType, String, IReadOnlyList) HasForeignKeyBuilder(EntityType, String, IReadOnlyList(Of PropertyInfo))

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

protected virtual InternalRelationshipBuilder HasForeignKeyBuilder(EntityType dependentEntityType, string dependentEntityTypeName, IReadOnlyList<PropertyInfo> foreignKeyProperties)
Protected Overridable Function HasForeignKeyBuilder(dependentEntityType As EntityType, dependentEntityTypeName As String, foreignKeyProperties As IReadOnlyList(Of PropertyInfo)) As InternalRelationshipBuilder
Parameters
dependentEntityType
EntityType EntityType
dependentEntityTypeName
System.String System.String
foreignKeyProperties
System.Collections.Generic.IReadOnlyList<System.Reflection.PropertyInfo> System.Collections.Generic.IReadOnlyList(Of System.Reflection.PropertyInfo)
Returns

HasForeignKeyBuilder(EntityType, String, IReadOnlyList) HasForeignKeyBuilder(EntityType, String, IReadOnlyList(Of String))

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

protected virtual InternalRelationshipBuilder HasForeignKeyBuilder(EntityType dependentEntityType, string dependentEntityTypeName, IReadOnlyList<string> foreignKeyPropertyNames)
Protected Overridable Function HasForeignKeyBuilder(dependentEntityType As EntityType, dependentEntityTypeName As String, foreignKeyPropertyNames As IReadOnlyList(Of String)) As InternalRelationshipBuilder
Parameters
dependentEntityType
EntityType EntityType
dependentEntityTypeName
System.String System.String
foreignKeyPropertyNames
System.Collections.Generic.IReadOnlyList<System.String> System.Collections.Generic.IReadOnlyList(Of System.String)
Returns

HasPrincipalKey(String, String[]) HasPrincipalKey(String, 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.

public virtual ReferenceReferenceBuilder HasPrincipalKey(string principalEntityTypeName, params string[] keyPropertyNames)
Public Overridable Function HasPrincipalKey(principalEntityTypeName As String, ParamArray keyPropertyNames As String()) As ReferenceReferenceBuilder
Parameters
principalEntityTypeName
System.String System.String

The name of the entity type that is the principal in this relationship (the type that has the reference key properties).

keyPropertyNames
System.String[] System.String()

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

Returns

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

HasPrincipalKey(Type, String[]) HasPrincipalKey(Type, 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.

public virtual ReferenceReferenceBuilder HasPrincipalKey(Type principalEntityType, params string[] keyPropertyNames)
Public Overridable Function HasPrincipalKey(principalEntityType As Type, ParamArray keyPropertyNames As String()) As ReferenceReferenceBuilder
Parameters
principalEntityType
System.Type System.Type

The entity type that is the principal in this relationship (the type that has the reference key properties).

keyPropertyNames
System.String[] System.String()

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

Returns

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

HasPrincipalKey(String[]) HasPrincipalKey(Of TPrincipalEntity)(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.

public virtual ReferenceReferenceBuilder HasPrincipalKey<TPrincipalEntity>(params string[] keyPropertyNames)where TPrincipalEntity : class
Public Overridable Function HasPrincipalKey(Of TPrincipalEntity As Class)(ParamArray keyPropertyNames As String()) As ReferenceReferenceBuilder
Type Parameters
TPrincipalEntity

The entity type that is the principal in this relationship (the type that has the reference key properties).

Parameters
keyPropertyNames
System.String[] System.String()

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

Returns

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

HasPrincipalKeyBuilder(EntityType, String, IReadOnlyList) HasPrincipalKeyBuilder(EntityType, String, IReadOnlyList(Of PropertyInfo))

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

protected virtual InternalRelationshipBuilder HasPrincipalKeyBuilder(EntityType principalEntityType, string principalEntityTypeName, IReadOnlyList<PropertyInfo> foreignKeyProperties)
Protected Overridable Function HasPrincipalKeyBuilder(principalEntityType As EntityType, principalEntityTypeName As String, foreignKeyProperties As IReadOnlyList(Of PropertyInfo)) As InternalRelationshipBuilder
Parameters
principalEntityType
EntityType EntityType
principalEntityTypeName
System.String System.String
foreignKeyProperties
System.Collections.Generic.IReadOnlyList<System.Reflection.PropertyInfo> System.Collections.Generic.IReadOnlyList(Of System.Reflection.PropertyInfo)
Returns

HasPrincipalKeyBuilder(EntityType, String, IReadOnlyList) HasPrincipalKeyBuilder(EntityType, String, IReadOnlyList(Of String))

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

protected virtual InternalRelationshipBuilder HasPrincipalKeyBuilder(EntityType principalEntityType, string principalEntityTypeName, IReadOnlyList<string> foreignKeyPropertyNames)
Protected Overridable Function HasPrincipalKeyBuilder(principalEntityType As EntityType, principalEntityTypeName As String, foreignKeyPropertyNames As IReadOnlyList(Of String)) As InternalRelationshipBuilder
Parameters
principalEntityType
EntityType EntityType
principalEntityTypeName
System.String System.String
foreignKeyPropertyNames
System.Collections.Generic.IReadOnlyList<System.String> System.Collections.Generic.IReadOnlyList(Of System.String)
Returns

IsRequired(Boolean) IsRequired(Boolean)

Configures whether this is a required relationship (i.e. whether the foreign key property(s) can be assigned null).

public virtual ReferenceReferenceBuilder IsRequired(bool required = true)
Public Overridable Function IsRequired(required As Boolean = True) As ReferenceReferenceBuilder
Parameters
required
System.Boolean System.Boolean

A value indicating whether this is a required relationship.

Returns

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

MemberwiseClone() MemberwiseClone()

Inherited from System.Object

OnDelete(DeleteBehavior) OnDelete(DeleteBehavior)

Configures how a delete operation is applied to dependent entities in the relationship when the principal is deleted or the relationship is severed.

public virtual ReferenceReferenceBuilder OnDelete(DeleteBehavior deleteBehavior)
Public Overridable Function OnDelete(deleteBehavior As DeleteBehavior) As ReferenceReferenceBuilder
Parameters
deleteBehavior
DeleteBehavior DeleteBehavior

The action to perform.

Returns

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

ReferenceEquals(Object, Object) ReferenceEquals(Object, Object)

Inherited from System.Object

ResolveEntityType(String) ResolveEntityType(String)

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

protected virtual EntityType ResolveEntityType(string entityTypeName)
Protected Overridable Function ResolveEntityType(entityTypeName As String) As EntityType
Parameters
entityTypeName
System.String System.String
Returns

ResolveEntityType(Type) ResolveEntityType(Type)

This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases.

protected virtual EntityType ResolveEntityType(Type entityType)
Protected Overridable Function ResolveEntityType(entityType As Type) As EntityType
Parameters
entityType
System.Type System.Type
Returns

ToString() ToString()

Inherited from System.Object

Explicit Interface Implementations

IInfrastructure.Instance Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure.Instance

The model that this relationship belongs to.

IMutableModel IInfrastructure<IMutableModel>.Instance { get; }
ReadOnly WriteOnly Property Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.IMutableModel>.Instance As IMutableModel Implements IInfrastructure(Of IMutableModel).Instance
Returns

IInfrastructure.Instance Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure.Instance

Gets the internal builder being used to configure this relationship.

InternalRelationshipBuilder IInfrastructure<InternalRelationshipBuilder>.Instance { get; }
ReadOnly WriteOnly Property Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.Internal.InternalRelationshipBuilder>.Instance As InternalRelationshipBuilder Implements IInfrastructure(Of InternalRelationshipBuilder).Instance
Returns