ServiceProviderExtensions Class
Definition
- Assembly
- Bodu.Financial.DependencyInjection.dll
- Package
- Bodu.Financial.DependencyInjection 1.0.0
Provides the connector that promotes the container-registered ICurrencyLookup to the ambient CurrencyResolution default, so the runtime-tagged Money resolves currencies through the application's configured catalogue.
public static class ServiceProviderExtensions
- Inheritance
-
ServiceProviderExtensions
- Inherited Members
Methods
UseCurrencyResolution(IServiceProvider)
Installs the container's ICurrencyLookup as the process-wide ambient currency resolver. Call once at start-up, after the service provider is built, when a custom lookup should back runtime Money construction and parsing.
public static IServiceProvider UseCurrencyResolution(this IServiceProvider provider)
Parameters
providerIServiceProviderThe built service provider.
Returns
- IServiceProvider
The same
provider, for chaining.
Remarks
This is a composition-root operation: it mutates process-wide state via SetDefault(ICurrencyLookup). Omitting the call leaves the registry-backed default in place, so existing applications behave identically without it.
IServiceProvider provider = services
.AddFinancialService(b => b.AddCurrencyLookup<MyCurrencyLookup>())
.Services
.BuildServiceProvider();
// Make the container's ICurrencyLookup back runtime Money construction and parsing.
provider.UseCurrencyResolution();
Exceptions
- ArgumentNullException
provideris null.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |