ReferenceCollectionBuilder<TPrincipalEntity, TDependentEntity> ReferenceCollectionBuilder(Of TPrincipalEntity, TDependentEntity) Class

Definition

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.

public class ReferenceCollectionBuilder<TPrincipalEntity, TDependentEntity> : ReferenceCollectionBuilder, IInfrastructure<IMutableModel>, IInfrastructure<InternalRelationshipBuilder> where TPrincipalEntity : class where TDependentEntity : class
Public Class ReferenceCollectionBuilder(Of TPrincipalEntity As Class, TDependentEntity As Class)
    Inherits ReferenceCollectionBuilder
    Implements IInfrastructure(Of IMutableModel), IInfrastructure(Of InternalRelationshipBuilder)

Type Parameters

TPrincipalEntity

The principal entity type in this relationship.

TDependentEntity

The dependent entity type in this relationship.

Inheritance
System.ObjectSystem.Object
ReferenceCollectionBuilder<TPrincipalEntity, TDependentEntity>ReferenceCollectionBuilder(Of TPrincipalEntity, TDependentEntity)
Implements

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.

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.

Methods

System.Object.Equals(System.Object) System.Object.Equals(System.Object) Inherited from System.Object
System.Object.Equals(System.Object, System.Object) System.Object.Equals(System.Object, System.Object) Inherited from System.Object
System.Object.GetHashCode() System.Object.GetHashCode() Inherited from System.Object
System.Object.GetType() System.Object.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.

HasForeignKey(Expression<Func<TDependentEntity, Object>>) HasForeignKey(Expression(Of Func(Of TDependentEntity, Object)))

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

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

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

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.

(Inherited from ReferenceCollectionBuilder)
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.

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.

(Inherited from ReferenceCollectionBuilder)
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.

(Inherited from ReferenceCollectionBuilder)
IsRequired(Boolean) IsRequired(Boolean)

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

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.

System.Object.ReferenceEquals(System.Object, System.Object) System.Object.ReferenceEquals(System.Object, System.Object) Inherited from System.Object
System.Object.ToString() System.Object.ToString() Inherited from System.Object
HasPrincipalKey(Expression<Func<TPrincipalEntity, Object>>) HasPrincipalKey(Expression<Func<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.

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.

(Inherited from ReferenceCollectionBuilder)
System.Object.MemberwiseClone() System.Object.MemberwiseClone() Inherited from System.Object

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.

(Inherited from ReferenceCollectionBuilder)
IInfrastructure<IMutableModel>.Instance Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.IMutableModel>.Instance

The model that this relationship belongs to.

(Inherited from ReferenceCollectionBuilder)
IInfrastructure<InternalRelationshipBuilder>.Instance Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Metadata.Internal.InternalRelationshipBuilder>.Instance

Gets the internal builder being used to configure this relationship.

(Inherited from ReferenceCollectionBuilder)
Metadata Metadata

The foreign key that represents this relationship.

(Inherited from ReferenceCollectionBuilder)

Extension Methods

Microsoft.EntityFrameworkCore.SqlServerReferenceCollectionBuilderExtensions.ForSqlServerHasConstraintName(System.String) Microsoft.EntityFrameworkCore.SqlServerReferenceCollectionBuilderExtensions.ForSqlServerHasConstraintName(System.String)
Microsoft.EntityFrameworkCore.SqlServerReferenceCollectionBuilderExtensions.ForSqlServerHasConstraintName<TPrincipalEntity, TDependentEntity>(System.String) Microsoft.EntityFrameworkCore.SqlServerReferenceCollectionBuilderExtensions.ForSqlServerHasConstraintName(Of TPrincipalEntity, TDependentEntity)(System.String)
Microsoft.EntityFrameworkCore.SqliteReferenceCollectionBuilderExtensions.ForSqliteHasConstraintName(System.String) Microsoft.EntityFrameworkCore.SqliteReferenceCollectionBuilderExtensions.ForSqliteHasConstraintName(System.String)
Microsoft.EntityFrameworkCore.SqliteReferenceCollectionBuilderExtensions.ForSqliteHasConstraintName<TPrincipalEntity, TDependentEntity>(System.String) Microsoft.EntityFrameworkCore.SqliteReferenceCollectionBuilderExtensions.ForSqliteHasConstraintName(Of TPrincipalEntity, TDependentEntity)(System.String)
Microsoft.EntityFrameworkCore.RelationalReferenceCollectionBuilderExtensions.HasConstraintName(System.String) Microsoft.EntityFrameworkCore.RelationalReferenceCollectionBuilderExtensions.HasConstraintName(System.String)
Microsoft.EntityFrameworkCore.RelationalReferenceCollectionBuilderExtensions.HasConstraintName<TPrincipalEntity, TDependentEntity>(System.String) Microsoft.EntityFrameworkCore.RelationalReferenceCollectionBuilderExtensions.HasConstraintName(Of TPrincipalEntity, TDependentEntity)(System.String)