Bodu.Financial.DependencyInjection
1.3.0
dotnet add package Bodu.Financial.DependencyInjection --version 1.3.0
NuGet\Install-Package Bodu.Financial.DependencyInjection -Version 1.3.0
<PackageReference Include="Bodu.Financial.DependencyInjection" Version="1.3.0" />
<PackageVersion Include="Bodu.Financial.DependencyInjection" Version="1.3.0" />
<PackageReference Include="Bodu.Financial.DependencyInjection" />
paket add Bodu.Financial.DependencyInjection --version 1.3.0
#r "nuget: Bodu.Financial.DependencyInjection, 1.3.0"
#:package Bodu.Financial.DependencyInjection@1.3.0
#addin nuget:?package=Bodu.Financial.DependencyInjection&version=1.3.0
#tool nuget:?package=Bodu.Financial.DependencyInjection&version=1.3.0
Bodu.Financial.DependencyInjection
API stability - Stable. The public API surface is committed: breaking changes are reserved for a major-version bump per SemVer, except a deliberate break that is recorded in the release notes and in the package's
CompatibilitySuppressions.xml. See versioning and support.
Microsoft.Extensions.DependencyInjection integration for Bodu.Financial. Registers currency lookup, financial options, exchange-rate providers, and named monetary contexts behind a small fluent builder. Financial JSON registration (AddFinancialJson) ships in the companion Bodu.Financial.Serialization.Json package.
Installation
dotnet add package Bodu.Financial.DependencyInjection
Targets net8.0 and net10.0. The registration extension methods, the IFinancialServiceBuilder builder, and FinancialOptions live in the Bodu.Financial namespace.
Registration
using Bodu.Financial;
using Bodu.Financial.ExchangeRates;
using Bodu.Financial.Serialization.Json; // Bodu.Financial.Serialization.Json package (optional, for AddFinancialJson)
services.AddFinancialService(configuration, sectionName: "Financial")
.AddExchangeRateProvider(new FixedRateTable(rates)) // any IRateProvider the container can build
.AddMonetaryContext("au", auContext);
services.AddFinancialJson(FinancialJsonPolicy.Strict);
| Entry point | Purpose |
|---|---|
AddFinancialService(IConfiguration?, string) |
Register ICurrencyLookup, bind FinancialOptions, return an IFinancialServiceBuilder |
AddFinancialService(Action<IFinancialServiceBuilder>) |
Register core services and compose fluently |
IFinancialServiceBuilder.AddCurrencyLookup<TLookup>() |
Replace the registered ICurrencyLookup |
.AddExchangeRateProvider<T>() / (instance) |
Register an IRateProvider (first registration wins) |
.AddDatedExchangeRateProvider<T>() / (instance) |
Register an IDatedRateProvider (first registration wins) |
.AddMonetaryContext(name, context) |
Register a named MonetaryContext as a keyed singleton |
IServiceProvider.UseCurrencyResolution() |
Install the container's ICurrencyLookup as the process-wide ambient resolver |
The provider methods register through TryAdd, and the generic form needs a type the container can construct. A web feed such as the ECB provider needs its own options and HttpClient, so register it through its package's Add<Source>ExchangeRates() method (for example AddEcbExchangeRates() from Bodu.Financial.ExchangeRates.Ecb) rather than AddExchangeRateProvider<EcbRateProvider>().
FinancialOptions is bound from the supplied configuration section (default "Financial"); it currently declares no settings of its own and exists as the binding seam for future options. The JSON registration services.AddFinancialJson(policy) (a JsonSerializerOptions keyed "Financial" with the financial converters) lives in the companion Bodu.Financial.Serialization.Json package.
Building and testing
To build this package from source and run its tests, see CONTRIBUTING.md.
License
MIT. © Bodu Pty. Ltd.
| Product | Versions 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 is compatible. 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. |
-
net10.0
- Bodu.Core (>= 1.3.0)
- Bodu.Financial (>= 1.3.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.12)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.12)
-
net8.0
- Bodu.Core (>= 1.3.0)
- Bodu.Financial (>= 1.3.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
NuGet packages (13)
Showing the top 5 NuGet packages that depend on Bodu.Financial.DependencyInjection:
| Package | Downloads |
|---|---|
|
Bodu.Financial.ExchangeRates.DependencyInjection
Shared dependency-injection machinery for Bodu.Financial web-based exchange-rate providers. Exposes AddWebRateProvider on IFinancialServiceBuilder, handling HttpClient configuration with Polly resilience, options binding, and singleton registration so each provider package delegates its registration plumbing here. |
|
|
Bodu.Financial.ExchangeRates.Caching
Caching layer for Bodu.Financial exchange-rate providers. Provides CachingRateProvider, a decorator that wraps any IDatedRateProvider and serves fresh rates from a shared on-disk cache (one TOML file per provider and currency pair), plus an AggregatingRateProvider (priority-fallback, averaging, per-pair routing). Includes the dependency-injection registrations (AddCachedRateProvider, AddAggregatedRateProvider) on IFinancialServiceBuilder. |
|
|
Bodu.Financial.ExchangeRates.Rba
Reserve Bank of Australia (RBA) historical exchange-rate provider for Bodu.Financial. Downloads and parses the RBA's published daily .xls files and serves them as Bodu.Financial.ExchangeRates.ExchangeRate values through IDatedRateProvider and IRateProvider, with an async range API and in-memory plus on-disk caching. Includes the dependency-injection registration extensions (AddRbaExchangeRates) that register the provider as a singleton backed by a configured HttpClient and bind RbaRateProviderOptions through Microsoft.Extensions.Options. |
|
|
Bodu.Financial.ExchangeRates.ExchangeRateHost
exchangerate.host exchange-rate provider for Bodu.Financial. Fetches and parses the exchangerate.host time-series and historical JSON endpoints and serves the results as Bodu.Financial.ExchangeRates.ExchangeRate values through IDatedRateProvider and IRateProvider, with an async range API over currency pairs. Includes the dependency-injection registration extensions (AddExchangeRateHostExchangeRates) for IServiceCollection and IFinancialServiceBuilder. |
|
|
Bodu.Financial.ExchangeRates.Fixer
Fixer (fixer.io) exchange-rate provider for Bodu.Financial. Fetches and parses the Fixer time-series and historical JSON endpoints and serves the results as Bodu.Financial.ExchangeRates.ExchangeRate values through IDatedRateProvider and IRateProvider, with an async range API over currency pairs. Includes the dependency-injection registration extensions (AddFixerExchangeRates) for IServiceCollection and IFinancialServiceBuilder. |
GitHub repositories
This package is not used by any popular GitHub repositories.