Efcore: Disallow tracking queries for owned entities without their owners

Created on 17 Aug 2018  路  9Comments  路  Source: dotnet/efcore

Querying Customer.Address should also bring in the Customer for tracking queries as there's no reason to track an owned entity without its owner.

closed-fixed type-bug

All 9 comments

Another option discussed in triage is to make queries for non roots of the aggregate always be no-tracking.

Referencing from #1985 to consider as part of the overall aggregate behaviors.

We will throw for now, until the Include pipeline supports including the owner without a navigation.

Decisions:

  • Owned entities cannot be tracked without their owner.
  • Querying for owned entities without their owners must be no-tracking.
  • Throw if the query would have been tracking; don't silently become no-tracking.

@AndriySvyryd - What is the status of this one. #13579 said to apply decision for here but that issue is closed now. Does that mean this one has been fixed?

#13579 was about tracking both the owner and the owned, that works now.
We still need to throw if owner is not included.

Poaching! 馃槈

@ajcvickers - Do we need to announce this as breaking change somewhere?

@smitpatel We should, but it's a low-impact. I can do it.

@smitpatel @AndriySvyryd I started writing it, but it's actually more of a bug that we ever tried to do this--an I couldn't even make it work in simple cases on 2.2, so I think it's fine to treat this as a bug we fixed.

Was this page helpful?
0 / 5 - 0 ratings