How can I tell Cosmos SDK to write documents with camel case without using [JsonPropertyName] in all properties of the model?
For instance in this example of code.
[FunctionName("CreaUsers")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "users")]
HttpRequest req,
[CosmosDB(
databaseName: Database.Name,
containerName: Database.Container,
Connection = "CosmosDBConnection")] CosmosClient client,
ILogger log)
{
var container = client.GetDatabase(Database.Name).GetContainer(Database.Container);
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
var user = JsonSerializer.Deserialize<User>(requestBody);
var id = Guid.NewGuid();
user.Id = id;
user.UserId = id.ToString();
var result = await container.CreateItemAsync(user, new PartitionKey(id.ToString()));
log.LogInformation($"C# HTTP trigger function inserted one row");
return new NoContentResult();
}