BoeRateProviderOptions Class
Definition
- Namespace
- Bodu.Financial.ExchangeRates
- Assembly
- Bodu.Financial.ExchangeRates.Boe.dll
- Package
- Bodu.Financial.ExchangeRates.Boe 0.7.1
Configures how the BoeRateProvider downloads, caches, and interprets Bank of England daily spot exchange-rate data.
public sealed class BoeRateProviderOptions
- Inheritance
-
BoeRateProviderOptions
- Inherited Members
- Extension Methods
Remarks
Every member carries a working default, so the options bind cleanly through Microsoft.Extensions.Options and
require no configuration for the common case. The dependency-injection package binds this type from configuration
and a configure delegate.
The *LogLevel members set the LogLevel at which each diagnostic the provider emits is logged,
so consumers can re-tune verbosity per concern without category-wide log filters. Set any of them to
None to suppress that event entirely.
Constructors
BoeRateProviderOptions()
public BoeRateProviderOptions()
Properties
AllowSynchronousNetworkAccess
Gets or sets a value indicating whether a synchronous lookup may block to download a missing range on demand.
public bool AllowSynchronousNetworkAccess { get; set; }
Property Value
- bool
true to allow synchronous, blocking downloads from IDatedRateProvider lookups; false to serve only already-loaded data. Defaults to false, so the provider serves a snapshot of already-loaded data and a synchronous miss does not reach the network.
Remarks
Blocking on network I/O from a synchronous method can deadlock in environments with a single-threaded synchronization context (classic ASP.NET, WPF, WinForms), so the default is snapshot-only. Leave this false and warm the store with LoadRangeAsync(DateOnly, DateOnly, CancellationToken) at startup; set it to true only to opt in to a blocking on-demand fetch from the synchronous lookup path.
CacheDirectory
Gets or sets the directory used by the on-disk cache.
public string? CacheDirectory { get; set; }
Property Value
DownloadCompletedLogLevel
Gets or sets the level at which a completed range download (with its observation count) is logged.
public LogLevel DownloadCompletedLogLevel { get; set; }
Property Value
- LogLevel
The log level; defaults to Information.
DownloadFailedLogLevel
Gets or sets the level at which a failed range download is logged.
public LogLevel DownloadFailedLogLevel { get; set; }
Property Value
DownloadStartingLogLevel
Gets or sets the level at which the start of a range download is logged.
public LogLevel DownloadStartingLogLevel { get; set; }
Property Value
EnableDiskCache
Gets or sets a value indicating whether downloaded ranges are persisted to an on-disk cache.
public bool EnableDiskCache { get; set; }
Property Value
Endpoint
Gets or sets the endpoint options describing the provider's connection to the Bank of England IADB - the base URL, query path, transport timeout, and request identity.
public BoeEndpointOptions Endpoint { get; set; }
Property Value
- BoeEndpointOptions
The endpoint options; defaults to a new BoeEndpointOptions targeting the IADB.
HistoryAvailability
Gets or sets the advertised history availability for the configured series.
public RateHistoryAvailability HistoryAvailability { get; set; }
Property Value
- RateHistoryAvailability
The advertised availability; defaults to a fixed floor of 2 January 1975, the inception of the Bank of England's daily spot exchange-rate series.
Remarks
The IADB daily spot series (XUDL*) begin on 2 January 1975 for the longest-running currencies; some
series start later (the euro series begins 4 January 1999, with the launch of the euro). The value is advisory -
it bounds the earliest date worth requesting for the configured Series catalogue, not a
per-series guarantee - so narrow it when the catalogue is restricted to later-inception series.
ObservationIngestedLogLevel
Gets or sets the level at which each individual ingested rate observation is logged.
public LogLevel ObservationIngestedLogLevel { get; set; }
Property Value
- LogLevel
The log level; defaults to Information.
OnDemandWindowDays
Gets or sets the number of days on each side of a requested date that an on-demand load fetches.
public int OnDemandWindowDays { get; set; }
Property Value
- int
The on-demand window radius in days; defaults to 10.
Remarks
A synchronous lookup that misses loads the inclusive range from the requested date minus this many days to the requested date plus this many days (clamped to the current date), so a date-resolution tolerance can still find a neighbouring business day without downloading the entire history.
RefreshInterval
Gets or sets how long a cached range response remains fresh before it is re-downloaded.
public TimeSpan RefreshInterval { get; set; }
Property Value
- TimeSpan
The refresh interval; defaults to 12 hours.
Remarks
A range that ends on or near the current date can gain a new observation each business day, so cached responses are treated as refreshable rather than immutable.
Series
Gets or sets the catalogue of currency series to request, mapping each quote currency to its IADB series code.
public IReadOnlyList<BoeSeries> Series { get; set; }
Property Value
- IReadOnlyList<BoeSeries>
The series catalogue; defaults to Default.
Methods
TryValidate(out string?)
Attempts to validate the options without throwing, reporting the first invariant that is violated.
public bool TryValidate(out string? error)
Parameters
errorstringWhen this method returns false, a message describing the first violated invariant; otherwise null.
Returns
Remarks
The throwing Validate() method is expressed in terms of this method, and the dependency-injection
registration wires it into ValidateOnStart so misconfiguration fails fast at application startup.
Validate()
Validates the options, throwing when a required value is missing or an invariant is violated.
public void Validate()
Exceptions
- ArgumentException
Thrown when Endpoint is null or fails validation; Series is null or empty; OnDemandWindowDays is negative; RefreshInterval is not greater than zero; or any
*LogLevelis not a defined LogLevel.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |