Patching fails, since it cannot convert the ISO date string to an Instant, unless the global JSON serializer is set up to support those datatypes:
JsonConvert.DefaultSettings = () => new JsonSerializerSettings()
.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
However, one might need a different global configuration than I want to use for patching. Therefore, it should be possible to provide a custom JSON converter for patching, rather than the global one:
var settings = new JsonSerializerSettings().ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
var myJsonSerializer = JsonSerializer.Create(settings);
patch.ApplyTo(myEntity, myJsonSerializer);
Patching does not work when the entity uses custom datatypes that are not serializeable by default.
In my case, I use NodaTime to provide time-dependent information in a save manner:
Patching fails, since it cannot convert the ISO date string to an Instant, unless the global JSON serializer is set up to support those datatypes:
However, one might need a different global configuration than I want to use for patching. Therefore, it should be possible to provide a custom JSON converter for patching, rather than the global one: