Table of Contents

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)
Source
OandaServiceCollectionExtensions.cs

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

services IServiceCollection

The service collection to register into.

configuration IConfiguration

An optional configuration root. When supplied, FinancialOptions is bound from the Financial section and OandaRateProviderOptions from sectionName.

sectionName string

The OANDA configuration section name. Defaults to Financial:Oanda.

configure Action<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 services is null.

ArgumentException

Thrown when sectionName is empty or white space.

Applies to

ProductVersions
.NET8, 10