You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Querying a table-splitting dependent of a derived TPH type returns rows of other types #39458
CatProfile shares the Animal table with Cat, a derived type in a TPH hierarchy. context.Set<CatProfile>() returns a profile for every row in the table, including the Dog row, which has no profile:
SELECT"a"."Id", "a"."Note"FROM"Animal"AS"a"
Expected: only the profiles of Cat rows. Loading them through Cat.Profile is correct.
Related: #38659 (same model shape, but materializing the base type).
This is also why #39448 rejects JSON complex properties on dependents of sibling types mapped to the same column: Set<CatProfile>() would return the Dog's JSON.
context.AddRange(newDog{Name="Rex"},newCat{Name="Tom",Profile=newCatProfile{Note="cat"}});awaitcontext.SaveChangesAsync();varprofiles=awaitcontext.Set<CatProfile>().ToListAsync();// 2 profiles: Tom's, and one for Rex
EF Core version
7.0.0 and later (checked 7.0.0, 8.0.0, 9.0.0, 10.0.14, 11.0.0-rc.3). Regression: 6.0 joined the principal and filtered by its discriminator:
Activity
MihuBot commentedon Oct 29, 2026
I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):
Filter required table-splitting dependents of a derived TPH type by i…
Filter required table-splitting dependents of a derived TPH type by i…