Skip to content
Tracon

TraconSqliteOptions

Namespace Tracon · Assembly Tracon.Sqlite.dll

Settings for Tracon’s SQLite persistence layer.

public sealed class TraconSqliteOptions

objectTraconSqliteOptions

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Validation is done manually in Tracon.TraconSqliteOptionsValidator; DataAnnotations is not used.

public TraconSqliteOptions()

The full path of the configuration section settings are read from.

public const string SectionName = "Tracon:Sqlite"

string

Whether pending migrations should be applied automatically at application startup.

public bool AutoApplyMigrations { get; set; }

bool

Upper time limit for a single SQL command (seconds). 0 means unlimited.

public int CommandTimeoutSeconds { get; set; }

int

The SQLite connection string (example: Data Source=tracon.db).

public string? ConnectionString { get; set; }

string?

A bare Data Source=:memory: is not supported: this library opens a new connection for every operation via DbDataSource.CreateDbConnection, and in SQLite a bare :memory: gives each connection its own isolated, anonymous database — even adding Cache=Shared does not change this (only a URI-form name can be shared). Result: migrations get applied on one connection, the first query lands on a different (empty) database and crashes with “no such table”. Use the URI form for a shared in-memory database instead, e.g. Data Source=file:tracon?mode=memory&cache=shared or Data Source=file::memory:?cache=shared. This setting is rejected during validation (Tracon.TraconSqliteOptionsValidator).

The data source Tracon uses, instead of building its own from TraconSqliteOptions.ConnectionString.

public DbDataSource? DataSource { get; set; }

DbDataSource?

Microsoft.Data.Sqlite does not itself offer a DbDataSource implementation; give an adapter of your own if you need one. When set, TraconSqliteOptions.ConnectionString is not required, and giving both is a startup error.

Tracon does not take ownership: the instance is never disposed. The caller keeps ownership and disposes it when the host shuts down.

Whether the “views” migration set is applied. Default false.

public bool EnableReadViews { get; set; }

bool

Creates {prefix}runs_v1, a versioned, read-only, narrow view a consumer can query directly (for example from an EF Core keyless entity) without depending on the internal runs table shape. Off by default: a consumer that never opts in pays nothing for it.

The prefix added to the names of Tracon tables. The consumer’s own tables are never touched, under any condition.

public string TablePrefix { get; set; }

string

SQLite has no schema concept; this is the SQLite equivalent (“do not touch the consumer’s schema”). The prefix goes through the SAME strict validation as PostgreSQL/SQL Server’s schema name: starts with a lowercase letter or underscore, contains lowercase letters, digits, and underscores, at most 63 characters.