Skip to content
Tracon

TraconSqlServerBuilderExtensions

Namespace Tracon · Assembly Tracon.SqlServer.dll

Extensions that add SQL Server persistence to the Tracon chain.

public static class TraconSqlServerBuilderExtensions

objectTraconSqlServerBuilderExtensions

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

Enables SQL Server persistence given a connection string.

public static ITraconBuilder UseSqlServer(this ITraconBuilder builder, string connectionString)

builder ITraconBuilder

The Tracon chain.

connectionString string

The SQL Server connection string.

ITraconBuilder

The continuation of the chain.

builder.AddTracon()
.UseSqlServer(builder.Configuration.GetConnectionString("Tracon")!);

ArgumentNullException

builder is null.

ArgumentException

connectionString is empty.

UseSqlServer(ITraconBuilder, IConfiguration)

Section titled “ UseSqlServer(ITraconBuilder, IConfiguration)”

Enables SQL Server persistence, reading settings from the Tracon:SqlServer section.

public static ITraconBuilder UseSqlServer(this ITraconBuilder builder, IConfiguration configurationSection)

builder ITraconBuilder

The Tracon chain.

configurationSection IConfiguration

The section settings are read from. Usually configuration.GetSection(TraconSqlServerOptions.SectionName).

ITraconBuilder

The continuation of the chain.

ArgumentNullException

One of the parameters is null.

UseSqlServer(ITraconBuilder, Action<TraconSqlServerOptions>)

Section titled “ UseSqlServer(ITraconBuilder, Action<TraconSqlServerOptions>)”

Enables SQL Server persistence with settings given in code.

public static ITraconBuilder UseSqlServer(this ITraconBuilder builder, Action<TraconSqlServerOptions> configure)

builder ITraconBuilder

The Tracon chain.

configure Action<TraconSqlServerOptions>

The settings mutator.

ITraconBuilder

The continuation of the chain.

Stores are registered with ServiceCollectionDescriptorExtensions.Replace, not TryAdd. AddTracon has already registered the in-memory stores with TryAddSingleton and runs before this call in the chain; using TryAdd here would silently do nothing.

Overwriting is correct here because UseSqlServer is the consumer’s explicit choice. The “register with TryAdd” rule is for Tracon’s defaults, not for explicit calls.

ArgumentNullException

One of the parameters is null.