You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to configure a many-many relationship where the second entity has no navigation property?
Looking at the overloads of CollectionNavigationBuilder<TEntity, TRelatedEntity>.WithMany, all of them require a property to be passed.
I expected a similar API to WithOne, that has an overload with an optional parameter.
Another thing I noticed is that the documenation of the overload that takes a lambda expression states that:
If no property is specified, the relationship will be configured without a navigation property on the other end of the relationship.
But how can we call that method without a property?
Is there a way to configure a many-many relationship where the second entity has no navigation property?
Looking at the overloads of
CollectionNavigationBuilder<TEntity, TRelatedEntity>.WithMany
, all of them require a property to be passed.I expected a similar API to
WithOne
, that has an overload with an optional parameter.Another thing I noticed is that the documenation of the overload that takes a lambda expression states that:
But how can we call that method without a property?
Example
Let's say we have these two classes:
I expected the following configuration to work, but it doesn't compile:
Provider and version information
EF Core version: 5.0.0-rc.2.20475.6
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 5.0
Operating system: Windows 10
IDE: Visual Studio 2019 16.8.0 Preview 6.0
The text was updated successfully, but these errors were encountered: