ReferenceReferenceBuilder<TEntity, TRelatedEntity> ReferenceReferenceBuilder(Of TEntity, TRelatedEntity) 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<TEntity, TRelatedEntity> : ReferenceReferenceBuilder, IInfrastructure<IMutableModel>, IInfrastructure<InternalRelationshipBuilder> where TEntity : class where TRelatedEntity : classPublic Class ReferenceReferenceBuilder(Of TEntity As Class, TRelatedEntity As Class)
    Inherits ReferenceReferenceBuilder
    Implements IInfrastructure(Of IMutableModel), IInfrastructure(Of InternalRelationshipBuilder)

Type Parameters

TEntity
TRelatedEntity

Inheritance Hierarchy

Inherited Members

Builder,
Builder,
IInfrastructure<InternalRelationshipBuilder>.Instance,
Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.Internal.InternalRelationshipBuilder>.Instance,
Metadata,
Metadata,
IInfrastructure<IMutableModel>.Instance,
Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.IMutableModel>.Instance,
HasForeignKeyBuilder(EntityType, String, IReadOnlyList<String>),
HasForeignKeyBuilder(EntityType, String, IReadOnlyList(Of String)),
HasForeignKeyBuilder(EntityType, String, IReadOnlyList<PropertyInfo>),
HasForeignKeyBuilder(EntityType, String, IReadOnlyList(Of PropertyInfo)),
HasPrincipalKeyBuilder(EntityType, String, IReadOnlyList<String>),
HasPrincipalKeyBuilder(EntityType, String, IReadOnlyList(Of String)),
HasPrincipalKeyBuilder(EntityType, String, IReadOnlyList<PropertyInfo>),
HasPrincipalKeyBuilder(EntityType, String, IReadOnlyList(Of PropertyInfo)),
ResolveEntityType(String),
ResolveEntityType(String),
ResolveEntityType(Type),
ResolveEntityType(Type),
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.

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 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. 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.

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 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.

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 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.

Constructors

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

    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(EntityType declaringEntityType, EntityType relatedEntityType, InternalRelationshipBuilder builder)Public Sub New(declaringEntityType As EntityType, relatedEntityType As EntityType, builder As InternalRelationshipBuilder)

    Parameters

  • 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

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<TEntity, TRelatedEntity> HasAnnotation(string annotation, object value)Public Overridable Function HasAnnotation(annotation As String, value As Object) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

    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<TEntity, TRelatedEntity> HasForeignKey(string dependentEntityTypeName, params string[] foreignKeyPropertyNames)Public Overridable Function HasForeignKey(dependentEntityTypeName As String, ParamArray foreignKeyPropertyNames As String()) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

    Parameters

    • dependentEntityTypeName
      System.String
      System.String

      The name of 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<TEntity, TRelatedEntity> HasForeignKey(Type dependentEntityType, params string[] foreignKeyPropertyNames)Public Overridable Function HasForeignKey(dependentEntityType As Type, ParamArray foreignKeyPropertyNames As String()) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

    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>(Expression<Func<TDependentEntity, Object>>)
    HasForeignKey(Of TDependentEntity)(Expression(Of Func(Of TDependentEntity, Object)))

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

    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. 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.

    public virtual ReferenceReferenceBuilder<TEntity, TRelatedEntity> HasForeignKey<TDependentEntity>(Expression<Func<TDependentEntity, object>> foreignKeyExpression)where TDependentEntity : classPublic Overridable Function HasForeignKey(Of TDependentEntity As Class)(foreignKeyExpression As Expression(Of Func(Of TDependentEntity, Object))) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

    Parameters

    • foreignKeyExpression
      System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><TDependentEntity, System.Object>>
      System.Linq.Expressions.Expression<TDelegate>(Of System.Func<T, TResult>(Of TDependentEntity, System.Object))

      A lambda expression representing the foreign key property(s) (t => t.Id1).

      If the foreign 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 keys in HasPrincipalKey(Type, String[]).

    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<TEntity, TRelatedEntity> HasForeignKey<TDependentEntity>(params string[] foreignKeyPropertyNames)where TDependentEntity : classPublic Overridable Function HasForeignKey(Of TDependentEntity As Class)(ParamArray foreignKeyPropertyNames As String()) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

    Parameters

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

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

    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<TEntity, TRelatedEntity> HasPrincipalKey(string principalEntityTypeName, params string[] keyPropertyNames)Public Overridable Function HasPrincipalKey(principalEntityTypeName As String, ParamArray keyPropertyNames As String()) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

    Parameters

    • principalEntityTypeName
      System.String
      System.String

      The name of 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<TEntity, TRelatedEntity> HasPrincipalKey(Type principalEntityType, params string[] keyPropertyNames)Public Overridable Function HasPrincipalKey(principalEntityType As Type, ParamArray keyPropertyNames As String()) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

    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>(Expression<Func<TPrincipalEntity, Object>>)
    HasPrincipalKey(Of TPrincipalEntity)(Expression(Of Func(Of 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.

    public virtual ReferenceReferenceBuilder<TEntity, TRelatedEntity> HasPrincipalKey<TPrincipalEntity>(Expression<Func<TPrincipalEntity, object>> keyExpression)where TPrincipalEntity : classPublic Overridable Function HasPrincipalKey(Of TPrincipalEntity As Class)(keyExpression As Expression(Of Func(Of TPrincipalEntity, Object))) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

    Parameters

    • keyExpression
      System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><TPrincipalEntity, System.Object>>
      System.Linq.Expressions.Expression<TDelegate>(Of System.Func<T, TResult>(Of TPrincipalEntity, System.Object))

      A lambda expression representing the reference key property(s) (t => t.Id).

      If the principal key is made up of multiple properties then specify an anonymous type including the properties (t => new { t.Id1, t.Id2 }).

    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<TEntity, TRelatedEntity> HasPrincipalKey<TPrincipalEntity>(params string[] keyPropertyNames)where TPrincipalEntity : classPublic Overridable Function HasPrincipalKey(Of TPrincipalEntity As Class)(ParamArray keyPropertyNames As String()) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

    Parameters

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

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

    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<TEntity, TRelatedEntity> IsRequired(bool required = true)Public Overridable Function IsRequired(required As Boolean = True) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

    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<TEntity, TRelatedEntity> OnDelete(DeleteBehavior deleteBehavior)Public Overridable Function OnDelete(deleteBehavior As DeleteBehavior) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

    Parameters

    Returns

Details

Assembly

Microsoft.EntityFrameworkCore.dll