Skip to content

ConfigureLeft and ConfigureRight parameters are documented backwards #5014

Open
@rcocks-hl

Description

@rcocks-hl

Type of issue

Other (describe below)

Description

In the section "Many-to-many with class for join entity", the following code is documented:

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Post>()
        .HasMany(e => e.Tags)
        .WithMany(e => e.Posts)
        .UsingEntity<PostTag>(
            l => l.HasOne<Tag>().WithMany(e => e.PostTags),
            r => r.HasOne<Post>().WithMany(e => e.PostTags));
}

However, the CollectionCollectionBuilder class documents the parameters as:

    public virtual EntityTypeBuilder<TJoinEntity> UsingEntity
        <[DynamicallyAccessedMembers(IEntityType.DynamicallyAccessedMemberTypes)] TJoinEntity>(
            Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TLeftEntity, TJoinEntity>> configureRight,
            Func<EntityTypeBuilder<TJoinEntity>, ReferenceCollectionBuilder<TRightEntity, TJoinEntity>> configureLeft)

i.e. with Right configured first, then left.

I'm not sure if this is a confusion about whether Tag or Post is the left or right entity, or whether it's just a typo on l and r.

Page URL

https://learn.microsoft.com/en-us/ef/core/modeling/relationships/many-to-many

Content source URL

https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/modeling/relationships/many-to-many.md

Document Version Independent Id

9234f104-802f-8ee0-8a54-ff3b8f49857e

Platform Id

a076d101-f897-de00-06ce-d3d09a213092

Article author

@SamMonoRT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions