Description
Type of issue
Other (describe below)
Description
In the docs about how to configure many-to-many relationships with a class for a join entity:
The code sample looks like this:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Post>()
.HasMany(e => e.Tags)
.WithMany(e => e.Posts)
.UsingEntity<PostTag>(
l => l.HasOne<Tag>().WithMany().HasForeignKey(e => e.TagId),
r => r.HasOne<Post>().WithMany().HasForeignKey(e => e.PostId));
}
The call to UsingEntity<PostTag>()
has those 2 lambdas, the first one with a parameter of l
and the 2nd with a parameter named r
, suggesting "left" and "right".
The problem is that the UsingEntity
method signature has those reversed, where "right" is first, then "left". Like this: UsingEntity(Func<...> configureRight, Func<...> configureLeft)
The sample suggests the parameter order is (left, right) when in actuality it is (right, left).
Yes, type checking should prevent the user from doing something invalid, but it may confuse developer as to what is considered "left" and what is considered "right".
Page URL
Content source URL
Document Version Independent Id
9234f104-802f-8ee0-8a54-ff3b8f49857e