-
Notifications
You must be signed in to change notification settings - Fork 403
✨Configure unit conversions via IQuantityInfo #1578
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
Conversation
- Add `IQuantityInfo.RegisterUnitConversions` callback to configure unit conversions - Change `UnitConverter` to configure unit conversions from a list of `IQuantityInfo` - Change `UnitsNetSetup` to pass the default quantity infos into its default `UnitConverter` - Add sample conversions for `HowMuch`
|
Maybe you already have done something like this in your dragon PR, but while reviewing it seemed natural to add something like this. |
| foreach (QuantityInfo quantityInfo in quantityInfos) | ||
| { | ||
| var registerMethod = quantity.QuantityType.GetMethod(nameof(Length.RegisterDefaultConversions), BindingFlags.NonPublic | BindingFlags.Static); | ||
| registerMethod?.Invoke(null, new object[]{unitConverter}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good riddance to this reflection stuff
|
Yes, these are already covered by introducing the |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1578 +/- ##
======================================
Coverage 93% 93%
======================================
Files 311 311
Lines 28781 28780 -1
======================================
Hits 26864 26864
+ Misses 1917 1916 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
This PR was automatically closed due to inactivity. |
IQuantityInfo.RegisterUnitConversionscallback to configure unit conversionsUnitConverterto configure unit conversions from a list ofIQuantityInfoUnitsNetSetupto pass the default quantity infos into its defaultUnitConverterHowMuch