Skip to content

Commit

Permalink
Add a note on querying shared columns
Browse files Browse the repository at this point in the history
  • Loading branch information
joakimriedel authored Jul 9, 2021
1 parent d6e3cdd commit 37b3840
Showing 1 changed file with 3 additions and 0 deletions.
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]
> Relational database providers, such as SQL Server, will not automatically use the discriminator predicate when querying shared columns when 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 you need to manually add a filter on the discriminator, such as `Url = blob is RssBlog ? (blob as RssBlog).Url : null`.
## Table-per-type configuration

> [!NOTE]
Expand Down

0 comments on commit 37b3840

Please sign in to comment.