我用\locationId
而不是\LocationId
这样的驼峰分区键创建了集合。另外,在cosmosdb中插入/更新文档时,我还使用以下代码将它们添加为驼峰式:
T entity = null;
var settings = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
var messageBody = JsonConvert.SerializeObject(entity, Formatting.Indented, settings);
using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(messageBody)))
{
var res = Resource.LoadFrom<Document>(memoryStream);
await _client.UpsertDocumentAsync((await _collection).SelfLink, res, option);
}
但是,使用linq条件检索任何文档时,结果始终为null。我已经用[JsonProperty(PropertyName = "id")]
我在这里想念什么吗?