Table of Contents

OfxServiceCollectionExtensions Class

Definition

Namespace
Bodu.Financial.ExchangeRates
Assembly
Bodu.Financial.ExchangeRates.Ofx.dll
Package
Bodu.Financial.ExchangeRates.Ofx 0.7.1
Source
OfxServiceCollectionExtensions.cs

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

public static class OfxServiceCollectionExtensions
Inheritance
OfxServiceCollectionExtensions
Inherited Members

Methods

AddOfxExchangeRates(IServiceCollection, IConfiguration?, string, Action<OfxRateProviderOptions>?)

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

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

sectionName string

The OFX configuration section name. Defaults to Financial:Ofx.

configure Action<OfxRateProviderOptions>

An optional callback applied after OFX configuration binding.

Returns

IFinancialServiceBuilder

An IFinancialServiceBuilder for further composition.

Examples

IServiceCollection services = new ServiceCollection();

// Register the core financial services and the OFX provider in one call, tuning the
// OFX options inline rather than binding them from configuration.
services.AddOfxExchangeRates(configure: options =>
{
    options.UserAgent = "MyApp/1.0 (+https://example.com)";
    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