Table of Contents

Class CollectionCollectionBuilder<TLeftEntity, TRightEntity>

Namespace
Microsoft.EntityFrameworkCore.Metadata.Builders
Assembly
Microsoft.EntityFrameworkCore.dll

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

public class CollectionCollectionBuilder<TLeftEntity, TRightEntity> : CollectionCollectionBuilder where TLeftEntity : class where TRightEntity : class

Type Parameters

TLeftEntity

One of the entity types in this relationship.

TRightEntity

One of the entity types in this relationship.

Inheritance
CollectionCollectionBuilder<TLeftEntity, TRightEntity>
Inherited Members

Remarks

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.

See Modeling entity types and relationships for more information and examples.

Constructors

CollectionCollectionBuilder(IMutableEntityType, IMutableEntityType, IMutableSkipNavigation, IMutableSkipNavigation)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
public CollectionCollectionBuilder(IMutableEntityType leftEntityType, IMutableEntityType rightEntityType, IMutableSkipNavigation leftNavigation, IMutableSkipNavigation rightNavigation)

Parameters

leftEntityType IMutableEntityType
rightEntityType IMutableEntityType
leftNavigation IMutableSkipNavigation
rightNavigation IMutableSkipNavigation

Methods

UsingEntity(Action<EntityTypeBuilder>)

Configures the join entity type implementing the many-to-many relationship.

public virtual EntityTypeBuilder<TRightEntity> UsingEntity(Action<EntityTypeBuilder> configureJoinEntityType)

Parameters

configureJoinEntityType Action<EntityTypeBuilder>

The configuration of the join entity type.

Returns

EntityTypeBuilder<TRightEntity>

The builder for the originating entity type so that multiple configuration calls can be chained.

UsingEntity(Func<EntityTypeBuilder, ReferenceCollectionBuilder>, Func<EntityTypeBuilder, ReferenceCollectionBuilder>, Action<EntityTypeBuilder>)

Configures the relationships to the entity types participating in the many-to-many relationship.

public virtual EntityTypeBuilder<TRightEntity> UsingEntity(Func<EntityTypeBuilder, ReferenceCollectionBuilder> configureRight, Func<EntityTypeBuilder, ReferenceCollectionBuilder> configureLeft, Action<EntityTypeBuilder> configureJoinEntityType)

Parameters

configureRight Func<EntityTypeBuilder, ReferenceCollectionBuilder>

The configuration for the relationship to the right entity type.

configureLeft Func<EntityTypeBuilder, ReferenceCollectionBuilder>

The configuration for the relationship to the left entity type.

configureJoinEntityType Action<EntityTypeBuilder>

The configuration of the join entity type.

Returns

EntityTypeBuilder<TRightEntity>

The builder for the originating entity type so that multiple configuration calls can be chained.

UsingEntity(string, Action<EntityTypeBuilder>)

Configures the join entity type implementing the many-to-many relationship.

public virtual EntityTypeBuilder<TRightEntity> UsingEntity(string joinEntityName, Action<EntityTypeBuilder> configureJoinEntityType)

Parameters

joinEntityName string

The name of the join entity.

configureJoinEntityType Action<EntityTypeBuilder>

The configuration of the join entity type.

Returns

EntityTypeBuilder<TRightEntity>

The builder for the originating entity type so that multiple configuration calls can be chained.

UsingEntity(string, Func<EntityTypeBuilder, ReferenceCollectionBuilder>, Func<EntityTypeBuilder, ReferenceCollectionBuilder>, Action<EntityTypeBuilder>)

Configures the relationships to the entity types participating in the many-to-many relationship.

public virtual EntityTypeBuilder<TRightEntity> UsingEntity(string joinEntityName, Func<EntityTypeBuilder, ReferenceCollectionBuilder> configureRight, Func<EntityTypeBuilder, ReferenceCollectionBuilder> configureLeft, Action<EntityTypeBuilder> configureJoinEntityType)

Parameters

joinEntityName string

The name of the join entity.

configureRight Func<EntityTypeBuilder, ReferenceCollectionBuilder>

The configuration for the relationship to the right entity type.

configureLeft Func<EntityTypeBuilder, ReferenceCollectionBuilder>

The configuration for the relationship to the left entity type.

configureJoinEntityType Action<EntityTypeBuilder>

The configuration of the join entity type.

Returns

EntityTypeBuilder<TRightEntity>

The builder for the originating entity type so that multiple configuration calls can be chained.

UsingEntity(string, Type, Action<EntityTypeBuilder>)

Configures the join entity type implementing the many-to-many relationship.

public virtual EntityTypeBuilder<TRightEntity> UsingEntity(string joinEntityName, Type joinEntityType, Action<EntityTypeBuilder> configureJoinEntityType)

Parameters

joinEntityName string

The name of the join entity.

joinEntityType Type

The CLR type of the join entity.

configureJoinEntityType Action<EntityTypeBuilder>

The configuration of the join entity type.

Returns

EntityTypeBuilder<TRightEntity>

The builder for the originating entity type so that multiple configuration calls can be chained.

UsingEntity(string, Type, Func<EntityTypeBuilder, ReferenceCollectionBuilder>, Func<EntityTypeBuilder, ReferenceCollectionBuilder>, Action<EntityTypeBuilder>)

Configures the relationships to the entity types participating in the many-to-many relationship.

public virtual EntityTypeBuilder<TRightEntity> UsingEntity(string joinEntityName, Type joinEntityType, Func<EntityTypeBuilder, ReferenceCollectionBuilder> configureRight, Func<EntityTypeBuilder, ReferenceCollectionBuilder> configureLeft, Action<EntityTypeBuilder> configureJoinEntityType)

Parameters

joinEntityName string

The name of the join entity.

joinEntityType Type

The CLR type of the join entity.

configureRight Func<EntityTypeBuilder, ReferenceCollectionBuilder>

The configuration for the relationship to the right entity type.

configureLeft Func<EntityTypeBuilder, ReferenceCollectionBuilder>

The configuration for the relationship to the left entity type.

configureJoinEntityType Action<EntityTypeBuilder>

The configuration of the join entity type.

Returns

EntityTypeBuilder<TRightEntity>

The builder for the originating entity type so that multiple configuration calls can be chained.

UsingEntity(Type, Action<EntityTypeBuilder>)

Configures the join entity type implementing the many-to-many relationship.

public virtual EntityTypeBuilder<TRightEntity> UsingEntity(Type joinEntityType, Action<EntityTypeBuilder> configureJoinEntityType)

Parameters

joinEntityType Type

The CLR type of the join entity.

configureJoinEntityType Action<EntityTypeBuilder>

The configuration of the join entity type.

Returns

EntityTypeBuilder<TRightEntity>

The builder for the originating entity type so that multiple configuration calls can be chained.

UsingEntity(Type, Func<EntityTypeBuilder, ReferenceCollectionBuilder>, Func<EntityTypeBuilder, ReferenceCollectionBuilder>, Action<EntityTypeBuilder>)

Configures the relationships to the entity types participating in the many-to-many relationship.

public virtual EntityTypeBuilder<TRightEntity> UsingEntity(Type joinEntityType, Func<EntityTypeBuilder, ReferenceCollectionBuilder> configureRight, Func<EntityTypeBuilder, ReferenceCollectionBuilder> configureLeft, Action<EntityTypeBuilder> configureJoinEntityType)

Parameters

joinEntityType Type

The CLR type of the join entity.

configureRight Func<EntityTypeBuilder, ReferenceCollectionBuilder>

The configuration for the relationship to the right entity type.

configureLeft Func<EntityTypeBuilder, ReferenceCollectionBuilder>

The configuration for the relationship to the left entity type.

configureJoinEntityType Action<EntityTypeBuilder>

The configuration of the join entity type.

Returns

EntityTypeBuilder<TRightEntity>

The builder for the originating entity type so that multiple configuration calls can be chained.

UsingEntity<TJoinEntity>()

Configures the join entity type implementing the many-to-many relationship.

public virtual EntityTypeBuilder<TJoinEntity> UsingEntity<TJoinEntity>() where TJoinEntity : class

Returns

EntityTypeBuilder<TJoinEntity>

The builder for the join entity type.

Type Parameters

TJoinEntity

The CLR type of the join entity.

UsingEntity<TJoinEntity>(Action<EntityTypeBuilder<TJoinEntity>>)

Configures the join entity type implementing the many-to-many relationship.

public virtual EntityTypeBuilder<TRightEntity> UsingEntity<TJoinEntity>(Action<EntityTypeBuilder<TJoinEntity>> configureJoinEntityType) where TJoinEntity : class

Parameters

configureJoinEntityType Action<EntityTypeBuilder<TJoinEntity>>

The configuration of the join entity type.

Returns

EntityTypeBuilder<TRightEntity>

The builder for the originating entity type so that multiple configuration calls can be chained.

Type Parameters

TJoinEntity

The CLR type of the join entity.

UsingEntity<TJoinEntity>(Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>>, Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>>)

Configures the relationships to the entity types participating in the many-to-many relationship.

public virtual EntityTypeBuilder<TJoinEntity> UsingEntity<TJoinEntity>(Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>> configureRight, Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>> configureLeft) where TJoinEntity : class

Parameters

configureRight Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>>

The configuration for the relationship to the right entity type.

configureLeft Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>>

The configuration for the relationship to the left entity type.

Returns

EntityTypeBuilder<TJoinEntity>

The builder for the join type.

Type Parameters

TJoinEntity

The CLR type of the join entity.

UsingEntity<TJoinEntity>(Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>>, Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>>, Action<EntityTypeBuilder<TJoinEntity>>)

Configures the relationships to the entity types participating in the many-to-many relationship.

public virtual EntityTypeBuilder<TRightEntity> UsingEntity<TJoinEntity>(Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>> configureRight, Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>> configureLeft, Action<EntityTypeBuilder<TJoinEntity>> configureJoinEntityType) where TJoinEntity : class

Parameters

configureRight Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>>

The configuration for the relationship to the right entity type.

configureLeft Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>>

The configuration for the relationship to the left entity type.

configureJoinEntityType Action<EntityTypeBuilder<TJoinEntity>>

The configuration of the join entity type.

Returns

EntityTypeBuilder<TRightEntity>

The builder for the originating entity type so that multiple configuration calls can be chained.

Type Parameters

TJoinEntity

The CLR type of the join entity.

UsingEntity<TJoinEntity>(string)

Configures the join entity type implementing the many-to-many relationship.

public virtual EntityTypeBuilder<TJoinEntity> UsingEntity<TJoinEntity>(string joinEntityName) where TJoinEntity : class

Parameters

joinEntityName string

The name of the join entity.

Returns

EntityTypeBuilder<TJoinEntity>

The builder for the join entity type.

Type Parameters

TJoinEntity

The CLR type of the join entity.

UsingEntity<TJoinEntity>(string, Action<EntityTypeBuilder<TJoinEntity>>)

Configures the join entity type implementing the many-to-many relationship.

public virtual EntityTypeBuilder<TRightEntity> UsingEntity<TJoinEntity>(string joinEntityName, Action<EntityTypeBuilder<TJoinEntity>> configureJoinEntityType) where TJoinEntity : class

Parameters

joinEntityName string

The name of the join entity.

configureJoinEntityType Action<EntityTypeBuilder<TJoinEntity>>

The configuration of the join entity type.

Returns

EntityTypeBuilder<TRightEntity>

The builder for the originating entity type so that multiple configuration calls can be chained.

Type Parameters

TJoinEntity

The CLR type of the join entity.

UsingEntity<TJoinEntity>(string, Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>>, Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>>)

Configures the relationships to the entity types participating in the many-to-many relationship.

public virtual EntityTypeBuilder<TJoinEntity> UsingEntity<TJoinEntity>(string joinEntityName, Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>> configureRight, Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>> configureLeft) where TJoinEntity : class

Parameters

joinEntityName string

The name of the join entity.

configureRight Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>>

The configuration for the relationship to the right entity type.

configureLeft Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>>

The configuration for the relationship to the left entity type.

Returns

EntityTypeBuilder<TJoinEntity>

The builder for the join entity type.

Type Parameters

TJoinEntity

The CLR type of the join entity.

UsingEntity<TJoinEntity>(string, Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>>, Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>>, Action<EntityTypeBuilder<TJoinEntity>>)

Configures the relationships to the entity types participating in the many-to-many relationship.

public virtual EntityTypeBuilder<TRightEntity> UsingEntity<TJoinEntity>(string joinEntityName, Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>> configureRight, Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>> configureLeft, Action<EntityTypeBuilder<TJoinEntity>> configureJoinEntityType) where TJoinEntity : class

Parameters

joinEntityName string

The name of the join entity.

configureRight Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>>

The configuration for the relationship to the right entity type.

configureLeft Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>>

The configuration for the relationship to the left entity type.

configureJoinEntityType Action<EntityTypeBuilder<TJoinEntity>>

The configuration of the join entity type.

Returns

EntityTypeBuilder<TRightEntity>

The builder for the originating entity type so that multiple configuration calls can be chained.

Type Parameters

TJoinEntity

The CLR type of the join entity.