Skip to content
Tracon

TraconPostgreSqlOptions

Namespace Tracon · Assembly Tracon.PostgreSql.dll

Settings for Tracon’s PostgreSQL persistence layer.

public sealed class TraconPostgreSqlOptions

objectTraconPostgreSqlOptions

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

Validation is done by hand in Tracon.TraconPostgreSqlOptionsValidator; DataAnnotations is not used.

public TraconPostgreSqlOptions()

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

public const string SectionName = "Tracon:PostgreSql"

string

Whether pending migrations are applied automatically at application startup.

public bool AutoApplyMigrations { get; set; }

bool

Can be set to false in production and MigrationRunner run as a separate deployment step, so a long-running migration does not block application startup.

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

public int CommandTimeoutSeconds { get; set; }

int

The PostgreSQL connection string.

public string? ConnectionString { get; set; }

string?

This value is a secret and is never written to a file. Use dotnet user-secrets, an environment variable, or a secret manager. Not required when TraconPostgreSqlOptions.DataSource is set; giving both is an error.

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

public DbDataSource? DataSource { get; set; }

DbDataSource?

Must be an NpgsqlDataSource (built with NpgsqlDataSourceBuilder) — for example, the same instance an EF Core DbContext was configured with via UseNpgsql(dataSource). When set, TraconPostgreSqlOptions.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.

var dataSource = new Npgsql.NpgsqlDataSourceBuilder(connectionString).Build();
// Also give the same instance to your own EF Core DbContext
// (o => o.UseNpgsql(dataSource)) to share one connection pool.
builder.AddTracon()
.UsePostgreSql(o => o.DataSource = dataSource);

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

public bool EnableKnowledge { get; set; }

bool

The knowledge set needs the pgvector extension; a consumer on a managed PostgreSQL without permission to install extensions never sees it unless this is turned on. While it is false, no IVectorSearchStore is registered — an agent definition that requests vector search fails compilation with a clear error instead of a database error at run time.

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

public bool EnableReadViews { get; set; }

bool

Creates {schema}.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 schema Tracon’s tables are created in. The consumer’s public schema is never touched, under any circumstances.

public string SchemaName { get; set; }

string

Must follow the rules for an unquoted PostgreSQL identifier: starts with a lowercase letter or underscore, contains lowercase letters, digits, and underscores, at most 63 characters.