Interface ISqlConnectionFactory
Abstraction for creating instances.
Implementations may provide pooling, read/write splitting, or failover.
public interface ISqlConnectionFactory
Properties
LendsConnection
True when lends a connection the endpoint does not own. The endpoint then begins no
bool LendsConnection { get; }
Methods
CreateConnectionAsync(bool, CancellationToken)
Creates an opened database connection.
Task<DbConnection> CreateConnectionAsync(bool readOnly = false, CancellationToken ct = default)
ForQualifier(string?)
The factory a data source name with a qualifier stands for: dataSource=redb:orders finds the factory
ISqlConnectionFactory ForQualifier(string? qualifier)
LeaseAsync(IExchange, bool, CancellationToken)
The connection one sql: step runs on, given back when the lease is disposed. Default: a connection of the
Task<SqlConnectionLease> LeaseAsync(IExchange exchange, bool readOnly = false, CancellationToken ct = default)
Remarks
The sql: producers take their connection through . Its default body opens a connection
of the endpoint's own with , so a factory that implements only that method works as
before. A factory that lends a connection someone else owns (dataSource=redb: the connection a redb service
works on, in the transaction redb's commands run in) implements and
.