I have an issue during the serialization of the linq query using Azure function and DocumentClient. The query doesnt use the JsonProperty Attribute of my POCO.
The linq query returns {{"query":"SELECT * FROM root WHERE (root[\"ObjectType\"] = \"Campaign\") "}}
instead of {{"query":"SELECT * FROM root WHERE (root[\"objectType\"] = \"Campaign\") "}}
The linq query and the POCO
var query = client.CreateDocumentQuery<Obj>(UriFactory.CreateDocumentCollectionUri("db", "col"))
.Where(d => d.ObjectType == "MyObj")
.AsEnumerable();
public class Obj
{
[Newtonsoft.Json.JsonProperty("objectType")]
public string ObjectType { get; set; }
}
The azure function is a precompiled function launched with azure-functions-core-tools.
My dev environement is:
- VS 2017
- azure-functions-core-tools (latest)
- Net 4.6.1
- DocumentDB SDK: 1.14.0
- Newtonsoft: 10.0.0
The same code works well when it run in iisexpress.
Thanks for your help !