Open Moerup opened 1 year ago
@Moerup As a workaround, configure many-to-many first. For example:
builder.HasMany(x => x.Books).WithMany();
builder.Navigation(x => x.Books).AutoInclude();
Note for triage: this works with one-to-many, presumably because the navigation doesn't later change to a skip navigation.
Thanks for the workaround, seems to do the trick 👍
Using AutoInclude on navigation property when using a unidirectional many to many does not include the related entities. Explicitly including them in the Linq query works as expected.
A small test repo to reproduce the bug can be found here: https://github.com/Moerup/ManyToManyAutoInclude
Book entity:
Library entity:
Library configuration:
Queries:
Include provider and version information
EF Core version: 7.0.9 and 8.0.0-preview.6.23329.4 Database provider: Microsoft.EntityFrameworkCore.Sqlite and Microsoft.EntityFrameworkCore.SqlServer Target framework: .NET 7 Operating system: Windows and Linux (tested in docker) IDE: Visual Studio 2022 17.6.5