Open
Description
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
Document Version Independent Id
9234f104-802f-8ee0-8a54-ff3b8f49857e
Platform Id
a076d101-f897-de00-06ce-d3d09a213092
Article author
Metadata
Metadata
Assignees
Labels
No labels