OfxServiceCollectionExtensions Class
Definition
- Namespace
- Bodu.Financial.ExchangeRates
- Assembly
- Bodu.Financial.ExchangeRates.Ofx.dll
- Package
- Bodu.Financial.ExchangeRates.Ofx 0.7.1
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
servicesIServiceCollectionThe service collection to register into.
configurationIConfigurationAn optional configuration root. When supplied, FinancialOptions is bound from the
Financialsection and OfxRateProviderOptions fromsectionName.sectionNamestringThe OFX configuration section name. Defaults to
Financial:Ofx.configureAction<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
servicesis null.- ArgumentException
Thrown when
sectionNameis empty or white space.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |