Table of Contents

SqliteNotableDateCacheOptions Class

Definition

Namespace
Bodu.Globalization.Calendar.Caching
Assembly
Bodu.Globalization.Calendar.Caching.Sqlite.dll
Package
Bodu.Globalization.Calendar.Caching.Sqlite 1.0.0
Source
SqliteNotableDateCacheOptions.cs

Configures a SQLite-backed INotableDateCache: the location of the database computed years are persisted in and the connection-level concurrency settings applied on open.

public class SqliteNotableDateCacheOptions : NotableDateCacheOptions
Inheritance
SqliteNotableDateCacheOptions
Inherited Members
Extension Methods

Remarks

The database location is supplied either as a DatabaseFilePath - a path to a SQLite file created on first use - or as a fully specified ConnectionString for advanced scenarios such as a shared in-memory database. At least one must be set; ConnectionString takes precedence when both are supplied.

Constructors

SqliteNotableDateCacheOptions()

public SqliteNotableDateCacheOptions()

Properties

BusyTimeout

Gets or sets the time a connection waits for a held database lock to clear before reporting a busy error.

public TimeSpan BusyTimeout { get; set; }

Property Value

TimeSpan

The busy-wait duration applied as the SQLite busy_timeout pragma; defaults to five seconds.

ConnectionString

Gets or sets the full SQLite connection string used by the cache.

public string? ConnectionString { get; set; }

Property Value

string

The connection string, or null to derive one from DatabaseFilePath.

Remarks

Takes precedence over DatabaseFilePath when both are supplied, allowing scenarios such as a shared in-memory database (Data Source=name;Mode=Memory;Cache=Shared). A supplied value's presence is checked but its contents are not parsed until connect time.

DatabaseFilePath

Gets or sets the path to the SQLite database file used by the cache.

public string? DatabaseFilePath { get; set; }

Property Value

string

The database file path, or null when a full ConnectionString is supplied instead.

UseWriteAheadLogging

Gets or sets a value indicating whether the cache enables SQLite write-ahead logging (WAL) on the database.

public bool UseWriteAheadLogging { get; set; }

Property Value

bool

true to switch a file database to WAL journal mode on open; defaults to true.

Remarks

The setting is applied best-effort: a database that does not support WAL - notably an in-memory database - is left in its native journal mode rather than failing.

Methods

TryValidate(out string?)

Attempts to validate the options without throwing, reporting the first invariant that is violated.

public override bool TryValidate(out string? error)

Parameters

error string

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

Returns

bool

true when every invariant holds; otherwise false.

Remarks

The dependency-injection registration wires this method into ValidateOnStart so misconfiguration fails fast at application startup. Storage-specific option types override this method to add their own invariants after invoking the base implementation.

Validate()

Validates the option values, throwing when a rule is violated.

public override void Validate()

Exceptions

ArgumentException

Thrown when neither DatabaseFilePath nor ConnectionString is supplied.

ArgumentOutOfRangeException

Thrown when BusyTimeout is negative.

Applies to

ProductVersions
.NET8, 10