Table of Contents

RbaRateProviderOptions Class

Definition

Namespace
Bodu.Financial.ExchangeRates
Assembly
Bodu.Financial.ExchangeRates.Rba.dll
Package
Bodu.Financial.ExchangeRates.Rba 1.3.0
Source
RbaRateProviderOptions.cs

Configures how the RbaRateProvider downloads, caches, and interprets RBA exchange-rate data.

public sealed class RbaRateProviderOptions : WebRateProviderOptions
Inheritance
RbaRateProviderOptions
Inherited Members
Extension Methods

Remarks

This type derives from WebRateProviderOptions, which supplies the endpoint base address, the HTTP contract (timeout, user agent and response-size cap), the synchronous-access, look-back and refresh behavior, the advertised history, the currency-alias map, and the per-concern log levels. The constructor points BaseAddress at the RBA's historical statistics path, identifies the requests with a Bodu user agent, and maps the RBA's SDR units label to the ISO code XDR. The members declared here are RBA-specific: the Eras catalog and the on-disk cache settings, which are off by default.

The absolute URL of an era workbook is its FileName resolved against BaseAddress. An on-demand load reads every era the DefaultLookback window ending on the requested date reaches, so a date early in an era also loads the era before it. The inherited RefreshInterval governs the open-ended current era, in memory and in the on-disk cache: a cached copy older than the interval is downloaded again, and in memory the loaded current era serves for good a request that ends before the day it was downloaded, or on a day it returned rates for, while a request that reaches a later day downloads the era again once the interval has passed. A closed era is loaded once, and its cached copy never expires.

The RBA names each column's currency with a units label, so CurrencyAliases maps a label found among its keys to the ISO 4217 code its value gives while a workbook is read. The provider advertises the depth of its Eras catalog while HistoryAvailability is left at Unbounded, and any other value set there in its place. Every member carries a working default, so the options bind cleanly through Microsoft.Extensions.Options; the dependency-injection registration binds this type from configuration and a configure delegate.

Constructors

RbaRateProviderOptions()

Initializes a new instance of the RbaRateProviderOptions class with the RBA historical statistics path as its base address, a Bodu user agent, and the SDR to XDR currency alias.

public RbaRateProviderOptions()

Properties

CacheDirectory

Gets or sets the directory used by the on-disk cache.

public string? CacheDirectory { get; set; }

Property Value

string

The cache directory, or null to use a bodu-rba folder under the system temporary path.

EnableDiskCache

Gets or sets a value indicating whether downloaded era files are persisted to an on-disk cache.

public bool EnableDiskCache { get; set; }

Property Value

bool

true to enable the on-disk cache; otherwise false. Defaults to false.

Eras

Gets or sets the catalog of era files to draw from.

public IReadOnlyList<RbaEraWorkbook> Eras { get; set; }

Property Value

IReadOnlyList<RbaEraWorkbook>

The era catalog; defaults to Default.

Methods

TryValidateCore(out string?)

Validates the RBA-specific options, ensuring the era catalog is not empty.

protected override bool TryValidateCore(out string? error)

Parameters

error string

When this method returns false, a message describing the violated invariant; otherwise null.

Returns

bool

true when every RBA-specific invariant holds; otherwise false.

Applies to

ProductVersions
.NET8, 10