-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Milestone
Description
Good morning,
after upgrading Entity Framework Core to .NET 6 I faced a breaking change on my production API that was not listed on these docs.
It is related to Microsoft.EntityFrameworkCore.Query.NavigationBaseIncludeIgnored that change the EF Core behaviour when using multiple level properties.
The solution is explained on this question on Stack Overflow.
Old working code:
Tour tour = await _context.Tours.Include(mpt => mpt.MarkersPerTours)
.ThenInclude(mrk => mrk.Marker)
.ThenInclude(mrkProp => mrkProp.MarkersTranslations)
.ThenInclude(mrk => mrk.Marker)
.ThenInclude(mrkTp => mrkTp.Type)
.FirstOrDefaultAsync(t => t.Id == tourId);New working code:
Tour tour = await _context.Tours.Include(t => t.MarkersPerTours)
.ThenInclude(mpt => mpt.Marker)
.ThenInclude(mrk => mrk.MarkersTranslations)
.Include(tour => tour.MarkersPerTours)
.ThenInclude(mpt => mpt.Marker)
.ThenInclude(mrk => mrk.Type)
.FirstOrDefaultAsync(t => t.Id == tourId);Can it be a good idea to include it in the docs?
Thank you
Reactions are currently unavailable