FixerServiceCollectionExtensions Class
Definition
- Namespace
- Bodu.Financial.ExchangeRates
- Assembly
- Bodu.Financial.ExchangeRates.Fixer.dll
- Package
- Bodu.Financial.ExchangeRates.Fixer 0.7.1
Provides a one-call entry point that registers the core Bodu.Financial services together with the Fixer exchange-rate provider.
public static class FixerServiceCollectionExtensions
- Inheritance
-
FixerServiceCollectionExtensions
- Inherited Members
Methods
AddFixerExchangeRates(IServiceCollection, IConfiguration?, string, Action<FixerRateProviderOptions>?)
Registers the core Bodu.Financial services and the Fixer exchange-rate provider.
public static IFinancialServiceBuilder AddFixerExchangeRates(this IServiceCollection services, IConfiguration? configuration = null, string sectionName = "Financial:Fixer", Action<FixerRateProviderOptions>? configure = null)
Parameters
servicesIServiceCollectionThe service collection to register into.
configurationIConfigurationAn optional configuration root. When supplied, FinancialOptions is bound from the
Financialsection and FixerRateProviderOptions fromsectionName.sectionNamestringThe Fixer configuration section name. Defaults to
Financial:Fixer.configureAction<FixerRateProviderOptions>An optional callback applied after Fixer configuration binding.
Returns
- IFinancialServiceBuilder
An IFinancialServiceBuilder for further composition.
Examples
IServiceCollection services = new ServiceCollection();
services.AddFixerExchangeRates(configuration, configure: options => options.ApiKey = "…");
ServiceProvider provider = services.BuildServiceProvider();
var rates = provider.GetRequiredService<IDatedRateProvider>();
Exceptions
- ArgumentNullException
Thrown when
servicesis null.- ArgumentException
Thrown when
sectionNameis empty or white space.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |