public static JsonSerializerSettings BuildSettings(ILogicalTypeRegistry logicalTypeRegistry) { Guard.NotNull(logicalTypeRegistry, "logicalTypeRegistry"); return new JsonSerializerSettings { MissingMemberHandling = MissingMemberHandling.Error, // fail-fast TypeNameHandling = TypeNameHandling.Objects, Binder = new LogicalTypeSerializationBinder(logicalTypeRegistry), ContractResolver = new PrivateSetterAwareContractResolver(), Converters = new List<JsonConverter> { new LogicalTypeJsonConverter(logicalTypeRegistry), new MaybeJsonConverter(), new OutcomeJsonConverter(), new ResultJsonConverter() } }; }
public LogicalTypeSerializationBinder(ILogicalTypeRegistry logicalTypeRegistry) { _logicalTypeRegistry = Guard.NotNull(logicalTypeRegistry, "logicalTypeRegistry"); }
public LogicalTypeJsonConverter(ILogicalTypeRegistry logicalTypeRegistry) { _logicalTypeRegistry = Guard.NotNull(logicalTypeRegistry, "logicalTypeRegistry"); }
public static JsonSerializer Build(ILogicalTypeRegistry logicalTypeRegistry) { return JsonSerializer.Create(BuildSettings(logicalTypeRegistry)); }