ReferenceReferenceBuilder ReferenceReferenceBuilder Class

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.

Syntax

Declaration

public class ReferenceReferenceBuilder : IInfrastructure<IMutableModel>, IInfrastructure<InternalRelationshipBuilder>Public Class ReferenceReferenceBuilder
    Implements IInfrastructure(Of IMutableModel), IInfrastructure(Of InternalRelationshipBuilder)

Inheritance Hierarchy

  • System.Object
    System.Object
  • ReferenceReferenceBuilder
    ReferenceReferenceBuilder

Inherited Members

ToString(),
ToString(),
Equals(Object),
Equals(Object),
Equals(Object, Object),
Equals(Object, Object),
ReferenceEquals(Object, Object),
ReferenceEquals(Object, Object),
GetHashCode(),
GetHashCode(),
GetType(),
GetType(),
MemberwiseClone()
MemberwiseClone()

Constructors summary

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.

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.

Properties summary

Gets the internal builder being used to configure this relationship.

The foreign key that represents this relationship.

Methods summary

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

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

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.

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.

Explicit Interface Implementations summary

The model that this relationship belongs to.

Gets the internal builder being used to configure this relationship.

Constructors

  • 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

  • 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

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

    Property Value

  • Metadata
    Metadata

    The foreign key that represents this relationship.

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

    Property Value

Methods

  • 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

  • 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

  • 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

  • HasForeignKey<TDependentEntity>(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 : classPublic Overridable Function HasForeignKey(Of TDependentEntity As Class)(ParamArray foreignKeyPropertyNames As String()) As ReferenceReferenceBuilder

    Parameters

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

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

    Returns

  • HasForeignKeyBuilder(EntityType, String, IReadOnlyList<PropertyInfo>)
    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
    • dependentEntityTypeName
      System.String
      System.String
    • foreignKeyProperties
      System.Collections.Generic.IReadOnlyList<T><System.Reflection.PropertyInfo>
      System.Collections.Generic.IReadOnlyList<T>(Of System.Reflection.PropertyInfo)

    Returns

  • HasForeignKeyBuilder(EntityType, String, IReadOnlyList<String>)
    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
    • dependentEntityTypeName
      System.String
      System.String
    • foreignKeyPropertyNames
      System.Collections.Generic.IReadOnlyList<T><System.String>
      System.Collections.Generic.IReadOnlyList<T>(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

  • 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

  • HasPrincipalKey<TPrincipalEntity>(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 : classPublic Overridable Function HasPrincipalKey(Of TPrincipalEntity As Class)(ParamArray keyPropertyNames As String()) As ReferenceReferenceBuilder

    Parameters

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

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

    Returns

  • HasPrincipalKeyBuilder(EntityType, String, IReadOnlyList<PropertyInfo>)
    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
    • principalEntityTypeName
      System.String
      System.String
    • foreignKeyProperties
      System.Collections.Generic.IReadOnlyList<T><System.Reflection.PropertyInfo>
      System.Collections.Generic.IReadOnlyList<T>(Of System.Reflection.PropertyInfo)

    Returns

  • HasPrincipalKeyBuilder(EntityType, String, IReadOnlyList<String>)
    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
    • principalEntityTypeName
      System.String
      System.String
    • foreignKeyPropertyNames
      System.Collections.Generic.IReadOnlyList<T><System.String>
      System.Collections.Generic.IReadOnlyList<T>(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

  • 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

    Returns

  • 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

Explicit Interface Implementations

  • IInfrastructure<IMutableModel>.Instance
    Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.IMutableModel>.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<InternalRelationshipBuilder>.Instance
    Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.Internal.InternalRelationshipBuilder>.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

Details

Assembly

Microsoft.EntityFrameworkCore.dll