Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a note on querying shared columns #3321

Merged
merged 2 commits into from
Jul 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions entity-framework/core/modeling/inheritance.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ By default, when two sibling entity types in the hierarchy have a property with

[!code-csharp[Main](../../../samples/core/Modeling/FluentAPI/SharedTPHColumns.cs?name=SharedTPHColumns&highlight=9,13)]

> [!NOTE]
> Some database providers, such as SQL Server, will not automatically use the discriminator predicate when querying shared columns using a cast. The query `Url = (blob as RssBlog).Url` would also return the `Url` value for the sibling `Blog` rows. To restrict the query to `RssBlog` entities in the hierarchy you need to add a filter manually on the discriminator, such as `Url = blob is RssBlog ? (blob as RssBlog).Url : null`.
joakimriedel marked this conversation as resolved.
Show resolved Hide resolved

## Table-per-type configuration

> [!NOTE]
Expand Down