Skip to content

TransactionlessUnitOfWork class

namespace: Serenity.Data   assembly: Serenity.Net.Services

A unit of work implementation without an underlying actual transaction. Use with care, only to pass an IUnitOfWork instance to some methods where you don't want to actually start a transaction.

public class TransactionlessUnitOfWork : IAsyncDisposable, IDisposable, IUnitOfWork
parameter description
connection The connection.

Public Members

name description
TransactionlessUnitOfWork(…) A unit of work implementation without an underlying actual transaction. Use with care, only to pass an IUnitOfWork instance to some methods where you don't want to actually start a transaction.
Connection { get; } Gets the connection.
HasStartedTransaction { get; } Gets whether the unit of work's transaction was actually started. This implementation never starts one, so this always returns false.
event OnCommit Occurs when Commit is called as there is no underlying transaction. Like OnCommit, this signals operation success, not a database transaction commit.
event OnRollback Occurs when Dispose is called as there is no underlying transaction.
Commit() Does nothing other than calling onCommit events as there is no underlying transaction.
CommitAsync(…) Does nothing other than calling onCommit events asynchronously as there is no underlying transaction.
Dispose() Invokes the rollback events, as there is no underlying transaction to roll back.
DisposeAsync() Invokes the rollback events asynchronously, as there is no underlying transaction to roll back.

Exceptions

exception condition
ArgumentNullException connection

Remarks

Initializes a new instance of the class.

See Also