Open PanosKousidis opened 4 months ago
Can you share which SDK version you are using?
Seems related to https://github.com/Azure/azure-cosmos-dotnet-v3/pull/4138 ?
I just updated my original ticket description with more details
Can you share which SDK version you are using?
Tried with 3.37.1 and 3.41.0 and the behaviour is the same
Seems related to #4138 ?
If I'm not mistaken this is about enabling System.Text.Json
translation - which did not work in my example, I may be doing something wrong
@PanosKousidis To enable System.Text.Json
translation you need to use a custom serializer. There is an example of how to do this here: https://github.com/Azure/azure-cosmos-dotnet-v3/tree/master/Microsoft.Azure.Cosmos.Samples/Usage/SystemTextJson. Please let me know if you have any questions.
Thanks @Maya-Painter , but the issue is still there.
I've drilled down and I think the behaviour I see is not Cosmos SDK-related
There is a lambda expression passed in https://github.com/Azure/azure-cosmos-dotnet-v3/blob/6e1d40d33936d2f98b1d2341254d367c5253d5f4/Microsoft.Azure.Cosmos/src/Linq/ExpressionToSQL.cs#L1515-L1521
And even though the expression itself references the ChildClass, the member referenced in "Left" is the Name property of the ParentClass instead of the ChildClass. See screenshot below
It is not using the declared property of the ChildClass as seen in the Expression property
You can probably close this ticket if you also think that there is nothing that can be done on the Cosmos SDK side to alleviate this
I have the following case:
I have a couple of classes that inherit from a base class. This is because the only difference between the classes are the property names in Cosmos. The business logic is done by using the base class object.
The following reproduces the issue
I believe the JsonProperty attributes should be read from the ChildClass in the scenario above. Instead, it's using the parent's JsonProperty value and translates it to
my_custom_parent_name
instead ofmy_custom_child_name
. The Name2 property that is not overriding anything works as expectedThe above is using
Newtonsoft.Json
. Switching it to useSystem.Text.Json.Serialization
:This results in no translation at all - the test result shows
SELECT VALUE root FROM root WHERE ((root["Name"] = "test") AND (root["Name2"] = "test2"))
I tried
Microsoft.Azure.Cosmos
3.37.1 and 3.41.0The alternative I have right now is to execute direct SQL text instead