Class SqlConnectionLease
The connection one sql: step runs on: an open connection, the transaction its commands must be bound to, and
how it is given back. wraps a connection of the step's own, closed on release;
wraps a connection someone else owns (redb's, through dataSource=redb), handed back on release and never closed.
public sealed class SqlConnectionLease : IAsyncDisposable
Inheritance
Implements
Properties
IsBorrowed
True when the connection is lent (): the step neither owns it nor its transaction.
public bool IsBorrowed { get; }
Transaction
The transaction every command must be bound to; null when none is needed. binds it.
public DbTransaction? Transaction { get; }
Methods
Borrowed(DbConnection, DbTransaction?, Func<ValueTask>)
A connection the step does not own. release gives it back once and must not close it. The step
public static SqlConnectionLease Borrowed(DbConnection connection, DbTransaction? transaction, Func<ValueTask> release)
DisposeAsync()
Gives the connection back: disposes an owned one, hands a borrowed one back. The second call does nothing.
public ValueTask DisposeAsync()
Owned(DbConnection)
A connection of the step's own: disposes it.
public static SqlConnectionLease Owned(DbConnection connection)