-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename constructor argument 'numericalValue' to 'value' #705
Conversation
Codecov Report
@@ Coverage Diff @@
## master #705 +/- ##
=======================================
Coverage 58.25% 58.25%
=======================================
Files 166 166
Lines 37766 37766
=======================================
Hits 22001 22001
Misses 15765 15765 Continue to review full report at Codecov.
|
@tmilnthorp I don't see any problems with this, do you? If it helps some reflection libraries auto-map ctor params to properties then I guess that is a benefit. @rohahn Just a word of caution that you might be better off mapping to your own types for serialization. We are very likely to introduce breaking changes without increasing the major version, and this PR reflects that situation perfectly (renaming ctor params). See |
@angularsen Thanks for the warning. I read some of the discussions about this topic and I am aware of the potential problems. Our current workaround is quite similar and based on a custom resolver and formatter for MessagePack. But since MessagePack is optimized for performance (code generation instead of reflection), we would prefer a solution without custom code in the serialization pipeline. In our case the problem of breaking changes is mitigated, since we control all parts of the system and the serialization is not part of a the public API. |
Very well. This PR needs to merge in latest |
Aligning the name of the constructor argument with the property 'Value' allows MessagePack deserialization of types generated by QuantityGenerator. MessagePack can deserialize immutable types by passing the deserialized values of properties without a setter to an appropriate constructor.
- Rename constructor parameter 'numericalValue' to 'value' - Fix some typos in comments - Rename some abbreviations
eaa8e60
to
7a408bb
Compare
Looks good to me! Nuget on the way out. |
In a project we would like to serialize quantity objects (e.g. Pressure) with MessagePack for inter-process communication. We don't want to persist the data and all processes will use the same version of Units.NET.
Aligning the name of the constructor argument with the property 'Value' allows MessagePack deserialization of types generated by QuantityGenerator (with some minor changes to MessagePack). MessagePack can deserialize immutable types by passing the deserialized values of properties without a setter to an appropriate constructor.
I did not regenerate the classes in GeneratedCode to keep the changes as small as possible.