dotnet / dotnet/EntityFramework.Docs

Document: OwnedEntities requires AsNoTracking when queried separately

Open
#2,205 15 comments 1 reaction 0 assignees View on GitHub
area-query undocumented-feature
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.