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