Skip to content

Add an easy way to configure the Dapr serialization option when adding Sagaway #84

@alonf

Description

@alonf

make this kind of code more intuitive and simple:

var jsonSerializationOptions = new JsonSerializerOptions
{
Converters =
{
new EntityConverter()
},
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
};

builder.Services.AddSagawayContextPropagator();

builder.Services.AddControllers().AddDapr(b =>
{
b.AddSagawayContextPropagator();
b.UseJsonSerializationOptions(jsonSerializationOptions);
}).AddJsonOptions(options =>
{
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase,
allowIntegerValues: false));
options.JsonSerializerOptions.Converters.Add(new EntityConverter());
options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions