Closed BennieCopeland closed 3 years ago
After code splunking, I was able to work around the issue with a custom JsonConverter like so:
FSharpBsonMapper.UseCustomJsonConverters(new JsonConverter[] {new LocalDateJsonConverter(), new FSharpJsonConverter()});
Hello there @BennieCopeland, I am glad you were able to find the workaround! Do we need to add something from library point of view? (Maybe some docs I would guess)
Hi @Zaid-Ajaj, docs would be nice, yes. From a library point of view, maybe not make the converters global. I could see it potentially being useful to have different converters/mappers for different LiteDatabase files. And either always include the FSharpJsonConverter and provide a second method to replace it, or document that the developer has to provide it along with their custom converters. I'm a fan of the former, as that converter is the core of the record/DU/tuple handling, and I expect will rarely need to be overridden.
I'm using NodaTime LocalDate types on my records that I want to serialize as strings and deserialize back to LocalDates . The FSharpBsonMapper is ignoring the custom type mappings.