✨Configure unit conversions via IQuantityInfo#1578
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.
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