Azure cosmosdb 小写属性名

Azure cosmosdb 小写属性名,azure-cosmosdb,Azure Cosmosdb,我正在向Cosmos DB添加一个文档,行如下: client.CreateDocumentAsync(collectionLink, report).Wait(); 我的c#类是大写的,但标准json可以使用小写属性。在保存文档时,是否可以以某种方式确保这一点?一些DocumentClient构造函数接受一个名为JsonSerializerSettings的对象 您可以在那里提供不同的合同解析程序。在您的例子中,它是CamelCasePropertyNamesContractResolver

我正在向Cosmos DB添加一个文档,行如下:

client.CreateDocumentAsync(collectionLink, report).Wait();

我的c#类是大写的,但标准json可以使用小写属性。在保存文档时,是否可以以某种方式确保这一点?

一些
DocumentClient
构造函数接受一个名为
JsonSerializerSettings
的对象

您可以在那里提供不同的合同解析程序。在您的例子中,它是CamelCasePropertyNamesContractResolver

var client = new DocumentClient(new Uri(""), "", serializerSettings: new JsonSerializerSettings
    {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
    });