Class SqlConnectionOptions
Configuration options for a named data source connection.
public sealed class SqlConnectionOptions
Inheritance
Properties
CommandTimeout
Default command execution timeout in seconds. Default: 30.
public int CommandTimeout { get; set; }
ConnectionIdleTimeout
Idle timeout before a pooled connection is closed. Default: 5 minutes.
public TimeSpan ConnectionIdleTimeout { get; set; }
ConnectionLifetime
Maximum lifetime of a connection. Default: (unlimited).
public TimeSpan ConnectionLifetime { get; set; }
ConnectionString
Primary connection string (used for writes and default reads).
public string ConnectionString { get; set; }
ConnectTimeout
Timeout for establishing a new connection in seconds. Default: 15.
public int ConnectTimeout { get; set; }
EnableRetryOnFailure
Enable automatic retry on transient failures. Default: false.
public bool EnableRetryOnFailure { get; set; }
MaxRetries
Number of retry attempts for transient failures. Default: 0 (no retry).
public int MaxRetries { get; set; }
MinPoolSize
Minimum connection pool size. Default: 0 (provider default).
public int MinPoolSize { get; set; }
ProviderName
ADO.NET provider invariant name (e.g. "Microsoft.Data.SqlClient", "Npgsql", "MySqlConnector").
public string ProviderName { get; set; }
ReadConnectionString
Read replica connection string. Used only by endpoints with readOnly=true ();
public string? ReadConnectionString { get; set; }
TestOnBorrow
Validate connection on checkout from pool. Default: false.
public bool TestOnBorrow { get; set; }
ValidationQuery
SQL used to validate a connection. Default: "SELECT 1".
public string ValidationQuery { get; set; }
ValidationTimeout
Timeout for validation query in seconds. Default: 5.
public int ValidationTimeout { get; set; }