Table of Contents

Class CollectionCollectionBuilder

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

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

public class CollectionCollectionBuilder
Inheritance
CollectionCollectionBuilder
Derived
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

Properties

LeftEntityType

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]
protected virtual IMutableEntityType LeftEntityType { get; }

Property Value

IMutableEntityType

LeftNavigation

One of the navigations involved in the relationship.

public virtual IMutableSkipNavigation LeftNavigation { get; }

Property Value

IMutableSkipNavigation

ModelBuilder

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]
protected virtual InternalModelBuilder ModelBuilder { get; }

Property Value

InternalModelBuilder

RightEntityType

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]
protected virtual IMutableEntityType RightEntityType { get; }

Property Value

IMutableEntityType

RightNavigation

One of the navigations involved in the relationship.

public virtual IMutableSkipNavigation RightNavigation { get; }

Property Value

IMutableSkipNavigation

Methods

UsingEntity(Action<EntityTypeBuilder>)

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

public virtual EntityTypeBuilder UsingEntity(Action<EntityTypeBuilder> configureJoinEntityType)

Parameters

configureJoinEntityType Action<EntityTypeBuilder>

The configuration of the join entity type.

Returns

EntityTypeBuilder

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

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

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

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

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.

Returns

EntityTypeBuilder

The builder for the join entity type.

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

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

UsingEntity(string)

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

public virtual EntityTypeBuilder UsingEntity(string joinEntityName)

Parameters

joinEntityName string

The name of the join entity.

Returns

EntityTypeBuilder

The builder for the join entity type.

UsingEntity(string, Action<EntityTypeBuilder>)

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

public virtual EntityTypeBuilder 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

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

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

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

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

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.

Returns

EntityTypeBuilder

The builder for the join entity type.

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

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

UsingEntity(string, Type)

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

public virtual EntityTypeBuilder UsingEntity(string joinEntityName, Type joinEntityType)

Parameters

joinEntityName string

The name of the join entity.

joinEntityType Type

The CLR type of the join entity.

Returns

EntityTypeBuilder

The builder for the join entity type.

UsingEntity(string, Type, Action<EntityTypeBuilder>)

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

public virtual EntityTypeBuilder 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

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

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

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

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

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.

Returns

EntityTypeBuilder

The builder for the join entity type.

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

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

UsingEntity(string?, Type?, Func<IMutableEntityType, IMutableForeignKey>?, Func<IMutableEntityType, IMutableForeignKey>?)

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]
protected virtual IMutableEntityType UsingEntity(string? joinEntityName, Type? joinEntityType, Func<IMutableEntityType, IMutableForeignKey>? configureRight, Func<IMutableEntityType, IMutableForeignKey>? configureLeft)

Parameters

joinEntityName string
joinEntityType Type
configureRight Func<IMutableEntityType, IMutableForeignKey>
configureLeft Func<IMutableEntityType, IMutableForeignKey>

Returns

IMutableEntityType

UsingEntity(Type)

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

public virtual EntityTypeBuilder UsingEntity(Type joinEntityType)

Parameters

joinEntityType Type

The CLR type of the join entity.

Returns

EntityTypeBuilder

The builder for the join entity type.

UsingEntity(Type, Action<EntityTypeBuilder>)

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

public virtual EntityTypeBuilder 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

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

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

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

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

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.

Returns

EntityTypeBuilder

The builder for the join entity type.

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

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