CosmosClient with Custom Newtonsoft Serializer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cosmosClient = new CosmosClient("<cosmosDBConnectionString>", | |
new CosmosClientOptions | |
{ | |
Serializer = new CosmosJsonDotNetSerializer(new JsonSerializerSettings | |
{ | |
// Update your JSON Serializer Settings here. | |
TypeNameHandling = TypeNameHandling.Auto, | |
ReferenceLoopHandling = ReferenceLoopHandling.Error, | |
PreserveReferencesHandling = PreserveReferencesHandling.None, | |
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor | |
Converters = new JsonConverter[] | |
{ | |
new StringEnumConverter() | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment