OandaServiceCollectionExtensions Class
Definition
- Namespace
- Bodu.Financial.ExchangeRates
- Assembly
- Bodu.Financial.ExchangeRates.Oanda.dll
- Package
- Bodu.Financial.ExchangeRates.Oanda 0.7.1 (not published on nuget.org)
Provides a one-call entry point that registers the core Bodu.Financial services together with the OANDA exchange-rate provider.
public static class OandaServiceCollectionExtensions
- Inheritance
-
OandaServiceCollectionExtensions
- Inherited Members
Methods
AddOandaExchangeRates(IServiceCollection, IConfiguration?, string, Action<OandaRateProviderOptions>?)
Registers the core Bodu.Financial services and the OANDA exchange-rate provider.
public static IFinancialServiceBuilder AddOandaExchangeRates(this IServiceCollection services, IConfiguration? configuration = null, string sectionName = "Financial:Oanda", Action<OandaRateProviderOptions>? configure = null)
Parameters
servicesIServiceCollectionThe service collection to register into.
configurationIConfigurationAn optional configuration root. When supplied, FinancialOptions is bound from the
Financialsection and OandaRateProviderOptions fromsectionName.sectionNamestringThe OANDA configuration section name. Defaults to
Financial:Oanda.configureAction<OandaRateProviderOptions>An optional callback applied after OANDA configuration binding.
Returns
- IFinancialServiceBuilder
An IFinancialServiceBuilder for further composition.
Examples
IServiceCollection services = new ServiceCollection();
// Register the core financial services and the OANDA provider in one call, tuning the
// OANDA options inline rather than binding them from configuration.
services.AddOandaExchangeRates(configure: options =>
{
options.Price = "mid";
options.HttpTimeout = TimeSpan.FromSeconds(15);
});
Exceptions
- ArgumentNullException
Thrown when
servicesis null.- ArgumentException
Thrown when
sectionNameis empty or white space.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |