dotnet / dotnet/EntityFramework.Docs
Document: OwnedEntities requires AsNoTracking when queried separately
- Dominant language
- Mermaid
- Stars
- 1.7k
- Forks
- 2k
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 16
Description
The code below just crashes with "A tracking query projects owned entity without corresponding owner in result. Owned entities cannot be tracked without their owner":
```
.Select(x => new A
{
OwnedEntity = x.OwnedEntity
});
```
It worked fine on EF Core 2. No single word about that in the breaking changes doc!
I have had a hard time finding this comment:
https://github.com/aspnet/EntityFrameworkCore/issues/17617#issuecomment-529162589
I believe this pattern of querying data is quite often. At least I used to it since EF 6. Adding AsNoTracking() in these cases doesn't make sense for me considering the pattern. I understand it's too late to re-consider but please describe that behavior in the breaking changes at least.
Contributor guide
Assessment
This issue has not been assessed yet.