ReferenceCollectionBuilder ReferenceCollectionBuilder Class

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

Instances of this class are returned from methods when using the ModelBuilder API and it is not designed to be directly constructed in your application code.

Syntax

Declaration

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

Inheritance Hierarchy

  • System.Object
    System.Object
  • ReferenceCollectionBuilder
    ReferenceCollectionBuilder

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

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.

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

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.

Explicit Interface Implementations summary

The model that this relationship belongs to.

Gets the internal builder being used to configure this relationship.

Constructors

  • ReferenceCollectionBuilder(EntityType, EntityType, InternalRelationshipBuilder)
    ReferenceCollectionBuilder(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 ReferenceCollectionBuilder(EntityType principalEntityType, EntityType dependentEntityType, InternalRelationshipBuilder builder)Public Sub New(principalEntityType As EntityType, dependentEntityType As EntityType, builder As InternalRelationshipBuilder)

    Parameters

  • ReferenceCollectionBuilder(InternalRelationshipBuilder, ReferenceCollectionBuilder, Boolean, Boolean, Boolean)
    ReferenceCollectionBuilder(InternalRelationshipBuilder, ReferenceCollectionBuilder, 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 ReferenceCollectionBuilder(InternalRelationshipBuilder builder, ReferenceCollectionBuilder oldBuilder, bool foreignKeySet = false, bool principalKeySet = false, bool requiredSet = false)Protected Sub New(builder As InternalRelationshipBuilder, oldBuilder As ReferenceCollectionBuilder, foreignKeySet As Boolean = False, principalKeySet As Boolean = False, requiredSet As Boolean = False)

    Parameters

Properties

  • Builder
    Builder

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

    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[])
    HasForeignKey(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(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 ReferenceCollectionBuilder HasForeignKey(params string[] foreignKeyPropertyNames)Public Overridable Function HasForeignKey(ParamArray foreignKeyPropertyNames As String()) As ReferenceCollectionBuilder

    Parameters

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

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

    Returns

  • HasForeignKeyBuilder(IReadOnlyList<PropertyInfo>)
    HasForeignKeyBuilder(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(IReadOnlyList<PropertyInfo> foreignKeyProperties)Protected Overridable Function HasForeignKeyBuilder(foreignKeyProperties As IReadOnlyList(Of PropertyInfo)) As InternalRelationshipBuilder

    Parameters

    • foreignKeyProperties
      System.Collections.Generic.IReadOnlyList<T><System.Reflection.PropertyInfo>
      System.Collections.Generic.IReadOnlyList<T>(Of System.Reflection.PropertyInfo)

    Returns

  • HasForeignKeyBuilder(IReadOnlyList<String>)
    HasForeignKeyBuilder(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(IReadOnlyList<string> foreignKeyPropertyNames)Protected Overridable Function HasForeignKeyBuilder(foreignKeyPropertyNames As IReadOnlyList(Of String)) As InternalRelationshipBuilder

    Parameters

    • foreignKeyPropertyNames
      System.Collections.Generic.IReadOnlyList<T><System.String>
      System.Collections.Generic.IReadOnlyList<T>(Of System.String)

    Returns

  • HasPrincipalKey(String[])
    HasPrincipalKey(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 ReferenceCollectionBuilder HasPrincipalKey(params string[] keyPropertyNames)Public Overridable Function HasPrincipalKey(ParamArray keyPropertyNames As String()) As ReferenceCollectionBuilder

    Parameters

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

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

    Returns

  • HasPrincipalKeyBuilder(IReadOnlyList<PropertyInfo>)
    HasPrincipalKeyBuilder(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(IReadOnlyList<PropertyInfo> keyProperties)Protected Overridable Function HasPrincipalKeyBuilder(keyProperties As IReadOnlyList(Of PropertyInfo)) As InternalRelationshipBuilder

    Parameters

    • keyProperties
      System.Collections.Generic.IReadOnlyList<T><System.Reflection.PropertyInfo>
      System.Collections.Generic.IReadOnlyList<T>(Of System.Reflection.PropertyInfo)

    Returns

  • HasPrincipalKeyBuilder(IReadOnlyList<String>)
    HasPrincipalKeyBuilder(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(IReadOnlyList<string> keyPropertyNames)Protected Overridable Function HasPrincipalKeyBuilder(keyPropertyNames As IReadOnlyList(Of String)) As InternalRelationshipBuilder

    Parameters

    • keyPropertyNames
      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 ReferenceCollectionBuilder IsRequired(bool required = true)Public Overridable Function IsRequired(required As Boolean = True) As ReferenceCollectionBuilder

    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 ReferenceCollectionBuilder OnDelete(DeleteBehavior deleteBehavior)Public Overridable Function OnDelete(deleteBehavior As DeleteBehavior) As ReferenceCollectionBuilder

    Parameters

    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