TrickyMottram.UnitConversion.Service 1.0.1

dotnet add package TrickyMottram.UnitConversion.Service --version 1.0.1
                    
NuGet\Install-Package TrickyMottram.UnitConversion.Service -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TrickyMottram.UnitConversion.Service" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TrickyMottram.UnitConversion.Service" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="TrickyMottram.UnitConversion.Service" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TrickyMottram.UnitConversion.Service --version 1.0.1
                    
#r "nuget: TrickyMottram.UnitConversion.Service, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=TrickyMottram.UnitConversion.Service&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=TrickyMottram.UnitConversion.Service&version=1.0.1
                    
Install as a Cake Tool

TrickyMottram.UnitConversion.Service

The centralized orchestration service for the TrickyMottram Unit Conversion libraries.

This package provides a DI-ready service that coordinates multiple IUnitConverter implementations to handle dynamic unit conversion across all registered measurement domains (e.g., Length, Area, Temperature, etc.).

✨ Features

  • Smart delegation of conversions to the appropriate IUnitConverter
  • Dependency-injected service with support for runtime extensibility
  • Minimal logic with single-responsibility orchestration
  • Designed for ASP.NET Core and other .NET DI platforms

🔧 Usage Example

Registering Converters and the Service

services.AddSingleton<IUnitConverter, LengthConverter>();
services.AddSingleton<IUnitConverter, TemperatureConverter>();
services.AddSingleton<UnitConversionService>();

Using the Service

public class ConversionController : ControllerBase
{
    private readonly UnitConversionService _converter;

    public ConversionController(UnitConversionService converter)
    {
        _converter = converter;
    }

    [HttpGet]
    public IActionResult ConvertUnits(double value, string from, string to)
    {
        double result = _converter.Convert(value, from, to);
        return Ok(result);
    }
}

📚 Main Type

  • TrickyMottram.UnitConversion.Service.UnitConversionService

📦 Package Metadata

  • Target Framework: .NET 8
  • License: MIT
  • Source: GitHub Repository
  • Tags: unit conversion, service, di, dotnet

✅ Contributing

If you'd like to contribute improvements, logging features, or additional coordination logic, feel free to open a PR or raise an issue on the GitHub repo.


© Tricky Mottram

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 102 6/7/2025