I have a model that defines field date_sk
in Cosmos Db database, and correspondent DateSk
in code:
public class TestEntity { ...
[JsonPropertyName("date_sk")]
public Date DateSk { get; set; }
}
I have no issue with running query like SELECT * FROM c where c.date_sk='2011-11-11'
in Cosmos Db explorer, or as a raw query in c# like this:
FeedIterator<TestEntity> feeder = GetContainer().GetItemQueryIterator<TestEntity>(
new QueryDefinition($"SELECT * FROM c where c.date_sk='2011-11-11'"));
However when I try to run LINQ alternative:
var feeder = GetContainer()
.GetItemLinqQueryable<TestEntity>()
.Where(f => f.DateSk == "2021-11-11");
it throws no error, but nothing returned back, and when I put a breakpoint to see SQL query that runs behind scene, I can see SELECT VALUE root FROM root WHERE (root["DateSk"] = "2021-11-11")
. It shows DateSk
property name used f;at straight instead of date_sk
real field name set with JsonPropertyName attribute. Interestingly the mapping works fine if I use other than LINQ queries, at least data is properly transferred one direction date_sk->DateSk, so the JsonPropertyName attribute works fine in the rest of situations
Any idea what could be wrong?