Docs / MooTransaction Reference

MooTransaction Reference

Role#

MooTransaction represents an active SQL Server transaction created by db.BeginTransactionAsync(...) where db is a MooDbContext.

Properties#

  • Sql : MooSql
  • Bulk : MooBulk

Main methods#

</> C#
Task<int> ExecuteAsync(...)
Task<T> ScalarAsync<T>(...)
Task<T?> SingleAsync<T>(...)
Task<T?> SingleAsync<T>(..., Func<SqlDataReader, T> map, ...)
Task<List<T>> ListAsync<T>(...)
Task<List<T>> ListAsync<T>(..., Func<SqlDataReader, T> map, ...)
Task<TResult> QueryMultipleAsync<TResult>(..., Func<IMooMultiReader, TResult> read, ...)
Task CommitAsync(...)
ValueTask DisposeAsync()

Key points#

  • all commands share the same connection and SQL transaction
  • disposing an uncommitted transaction rolls it back automatically
  • once committed, that transaction instance is complete and cannot be reused for more execution calls