Table of Contents

ImfServiceCollectionExtensions Class

Definition

Namespace
Bodu.Financial.ExchangeRates
Assembly
Bodu.Financial.ExchangeRates.Imf.dll
Package
Bodu.Financial.ExchangeRates.Imf 0.7.1
Source
ImfServiceCollectionExtensions.cs

Provides a one-call entry point that registers the core Bodu.Financial services together with the IMF exchange-rate provider.

public static class ImfServiceCollectionExtensions
Inheritance
ImfServiceCollectionExtensions
Inherited Members

Methods

AddImfExchangeRates(IServiceCollection, IConfiguration?, string, Action<ImfRateProviderOptions>?)

Registers the core Bodu.Financial services and the IMF exchange-rate provider.

public static IFinancialServiceBuilder AddImfExchangeRates(this IServiceCollection services, IConfiguration? configuration = null, string sectionName = "Financial:Imf", Action<ImfRateProviderOptions>? 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 ImfRateProviderOptions from sectionName.

sectionName string

The IMF configuration section name. Defaults to Financial:Imf.

configure Action<ImfRateProviderOptions>

An optional callback applied after IMF configuration binding.

Returns

IFinancialServiceBuilder

An IFinancialServiceBuilder for further composition.

Examples

IServiceCollection services = new ServiceCollection();

services.AddImfExchangeRates(configuration);

ServiceProvider provider = services.BuildServiceProvider();
var rates = provider.GetRequiredService<IDatedRateProvider>();

Exceptions

ArgumentNullException

Thrown when services is null.

ArgumentException

Thrown when sectionName is empty or white space.

Applies to

ProductVersions
.NET8, 10