diff --git a/src/Shiny.Mediator/Infrastructure/SerializerService.cs b/src/Shiny.Mediator/Infrastructure/SerializerService.cs index bf4be39..f7575f2 100644 --- a/src/Shiny.Mediator/Infrastructure/SerializerService.cs +++ b/src/Shiny.Mediator/Infrastructure/SerializerService.cs @@ -11,11 +11,9 @@ public interface ISerializerService public class SerializerService : ISerializerService { - readonly JsonSerializerOptions jsonOptions; - - public SerializerService(JsonSerializerOptions? options = null) + public SerializerService() { - this.jsonOptions = options ?? new JsonSerializerOptions + this.JsonOptions = new JsonSerializerOptions { Converters = { @@ -24,15 +22,18 @@ public SerializerService(JsonSerializerOptions? options = null) }; } + + public JsonSerializerOptions JsonOptions { get; set; } + public string Serialize(T obj) { - var json = JsonSerializer.Serialize(obj, this.jsonOptions); + var json = JsonSerializer.Serialize(obj, this.JsonOptions); return json; } public T Deserialize(string json) { - var obj = JsonSerializer.Deserialize(json, this.jsonOptions)!; + var obj = JsonSerializer.Deserialize(json, this.JsonOptions)!; return obj; } } \ No newline at end of file