ReferenceReferenceBuilder<TEntity, TRelatedEntity> ReferenceReferenceBuilder(Of TEntity, TRelatedEntity) 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<TEntity, TRelatedEntity> : ReferenceReferenceBuilder, IInfrastructure<IMutableModel>, IInfrastructure<InternalRelationshipBuilder> where TEntity : class where TRelatedEntity : class
Public Class ReferenceReferenceBuilder(Of TEntity As Class, TRelatedEntity As Class)
    Inherits ReferenceReferenceBuilder
    Implements IInfrastructure(Of IMutableModel), IInfrastructure(Of InternalRelationshipBuilder)
Type Parameters
TEntity
TRelatedEntity
Inheritance
System.ObjectSystem.Object
ReferenceReferenceBuilder<TEntity, TRelatedEntity>ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)
Implements

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

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<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
ReferenceReferenceBuilder<TEntity, TRelatedEntity> ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

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<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
ReferenceReferenceBuilder<TEntity, TRelatedEntity> ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

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<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
ReferenceReferenceBuilder<TEntity, TRelatedEntity> ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

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

HasForeignKey(Expression<>>) 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 : class
Public Overridable Function HasForeignKey(Of TDependentEntity As Class)(foreignKeyExpression As Expression(Of Func(Of TDependentEntity, Object))) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)
Type Parameters
TDependentEntity

The entity type that is the dependent in this relationship. That is, the type that has the foreign key properties.

Parameters
foreignKeyExpression
System.Linq.Expressions.Expression<System.Func<TDependentEntity, System.Object>> System.Linq.Expressions.Expression(Of System.Func(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
ReferenceReferenceBuilder<TEntity, TRelatedEntity> ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

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

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.

(Inherited from ReferenceReferenceBuilder)

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.

(Inherited from ReferenceReferenceBuilder)

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
ReferenceReferenceBuilder<TEntity, TRelatedEntity> ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

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<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
ReferenceReferenceBuilder<TEntity, TRelatedEntity> ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

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

HasPrincipalKey(Expression<>>) 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 : class
Public Overridable Function HasPrincipalKey(Of TPrincipalEntity As Class)(keyExpression As Expression(Of Func(Of TPrincipalEntity, Object))) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)
Type Parameters
TPrincipalEntity

The entity type that is the principal in this relationship. That is, the type that has the reference key properties.

Parameters
keyExpression
System.Linq.Expressions.Expression<System.Func<TPrincipalEntity, System.Object>> System.Linq.Expressions.Expression(Of System.Func(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
ReferenceReferenceBuilder<TEntity, TRelatedEntity> ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

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

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.

(Inherited from ReferenceReferenceBuilder)

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.

(Inherited from ReferenceReferenceBuilder)

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
ReferenceReferenceBuilder<TEntity, TRelatedEntity> ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

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

The action to perform.

Returns
ReferenceReferenceBuilder<TEntity, TRelatedEntity> ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

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.

(Inherited from ReferenceReferenceBuilder)

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.

(Inherited from ReferenceReferenceBuilder)

ToString() ToString()

Inherited from System.Object

Properties

Builder Builder

Gets the internal builder being used to configure this relationship.

(Inherited from ReferenceReferenceBuilder)

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

The model that this relationship belongs to.

(Inherited from ReferenceReferenceBuilder)

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

Gets the internal builder being used to configure this relationship.

(Inherited from ReferenceReferenceBuilder)

Metadata Metadata

The foreign key that represents this relationship.

(Inherited from ReferenceReferenceBuilder)