BoeServiceCollectionExtensions Class
Definition
- Namespace
- Bodu.Financial.ExchangeRates
- Assembly
- Bodu.Financial.ExchangeRates.Boe.dll
- Package
- Bodu.Financial.ExchangeRates.Boe 0.7.1
Provides a one-call entry point that registers the core Bodu.Financial services together with the Bank of England exchange-rate provider.
public static class BoeServiceCollectionExtensions
- Inheritance
-
BoeServiceCollectionExtensions
- Inherited Members
Methods
AddBoeExchangeRates(IServiceCollection, IConfiguration?, string, Action<BoeRateProviderOptions>?)
Registers the core Bodu.Financial services and the Bank of England exchange-rate provider.
public static IFinancialServiceBuilder AddBoeExchangeRates(this IServiceCollection services, IConfiguration? configuration = null, string sectionName = "Financial:Boe", Action<BoeRateProviderOptions>? configure = null)
Parameters
servicesIServiceCollectionThe service collection to register into.
configurationIConfigurationAn optional configuration root. When supplied, FinancialOptions is bound from the
Financialsection and BoeRateProviderOptions fromsectionName.sectionNamestringThe Bank of England configuration section name. Defaults to
Financial:Boe.configureAction<BoeRateProviderOptions>An optional callback applied after Bank of England configuration binding.
Returns
- IFinancialServiceBuilder
An IFinancialServiceBuilder for further composition.
Remarks
IServiceCollection services = new ServiceCollection();
// One call wires up the core financial services plus the Bank of England provider.
services.AddBoeExchangeRates(configuration);
IServiceProvider 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 |