Open simondotm opened 4 years ago
It's typical to serialize to/from a database object that uses camelCase field names rather than the C# convention of PascalCase.
The MapTo attribute allows us override to specify a camelCase version eg.
MapTo
[MapTo("phoneNumber")] public string PhoneNumber { get; set; },
However, this is unnecessarily fragile, since a change of C# property name has to be updated in the attribute also.
An improvement to this would be a MapTo attribute parameter such as:
[MapTo(CamelCase=true)] public string PhoneNumber { get; set; },
Or alternatively perhaps a global setting similar to the JsonSerializerSettings that allows a global preference for camelCase property mappings.
JsonSerializerSettings
Thanks for a great library!
It's typical to serialize to/from a database object that uses camelCase field names rather than the C# convention of PascalCase.
The
MapTo
attribute allows us override to specify a camelCase version eg.However, this is unnecessarily fragile, since a change of C# property name has to be updated in the attribute also.
An improvement to this would be a MapTo attribute parameter such as:
Or alternatively perhaps a global setting similar to the
JsonSerializerSettings
that allows a global preference for camelCase property mappings.Thanks for a great library!