andrewlock / StronglyTypedId

A Rosyln-powered generator for strongly-typed IDs
MIT License
1.53k stars 82 forks source link

Implement the dictionary key (de)serialization for the System.Text.Json converter #113

Closed Varveyn closed 10 months ago

Varveyn commented 12 months ago

Since https://github.com/dotnet/runtime/issues/46520 has been implemented, the JsonConverter now has the ReadAsPropertyName and WriteAsPropertyName methods, which could be used to allow using strongly-typed IDs as dictionary keys during the (de)serialization. Would be great to have this behavior out-of-the-box.

andrewlock commented 10 months ago

Hi @Varveyn, I'm currently working on a big redesign of the library in this PR:

The main idea is to make the library much more maintainable while also giving people a mechanism to customise the generated IDs as much as they like.

I've included this fix as part of that redesign!