-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Cosmos: Issues when loading derived type via base set and vice versa #25886
Comments
Can you share more details what is the issue? |
Sure, I didn't dig into it, but as part of #25887 I enabled the FindTestBase suite for Cosmos, and the tests above failed - you can try checking out that PR and remove the skip, and you'll see right away. |
That is little friction. If you can post exception/error stack trace, generated SQL that would help us evaluate how difficult the fix is. |
No problem. In Find_derived_using_base_set_type_from_store, Find returns nothing at all, whereas in Find_base_type_using_derived_set_tracked it would seem like we attempt to materialize and track the same instance twice. Find_base_type_using_derived_set_tracked
Find_derived_using_base_set_type_from_store
|
Investigated this. We have a DbSet<BaseType>().Where(e => EF.Property<int>(e, "Id") == (int)ValueBuffer.get_Item(0)) For SQL Server with TPH, this translates to the following: DECLARE @__p_0 int = 78;
SELECT [b].[Id], [b].[Discriminator], [b].[Foo], [b].[Boo]
FROM [BaseType] AS [b]
WHERE [b].[Id] = @__p_0 This finds and returns an instance of the DerivedType, as expected. For Cosmos, the translation is: -- @__p_0='78'
SELECT c
FROM root c
WHERE (c["Discriminator"] IN ("BaseType", "DerivedType") AND (c["Id"] = @__p_0)) This does not find the DerivedType instance; it returns no results. |
That SQL should find derived type instance. It has id value and discriminator for derived type is also included in Where. |
See FindCosmosTest.Find_base_type_using_derived_set_tracked (and async), Find_derived_using_base_set_type_from_store (and async).
The text was updated successfully, but these errors were encountered: