Table of Contents

Class SqlTransactionContext

Namespace
Tripous.Data
Assembly
Tripous.Data.dll

Owns a database connection and a single transaction for the lifetime of an operation.

public class SqlTransactionContext : IDisposable
Inheritance
SqlTransactionContext
Implements
Inherited Members
Extension Methods

Constructors

SqlTransactionContext(DbConnection)

Constructor.

public SqlTransactionContext(DbConnection Connection)

Parameters

Connection DbConnection

Properties

Connection

Returns the owned connection.

public DbConnection Connection { get; }

Property Value

DbConnection

IsActive

Returns true when the transaction is active.

public bool IsActive { get; }

Property Value

bool

IsCompleted

Returns true when the transaction has been committed or rolled back.

public bool IsCompleted { get; }

Property Value

bool

Transaction

Returns the owned transaction.

public DbTransaction Transaction { get; }

Property Value

DbTransaction

Methods

BeginTransaction()

Opens the connection, if needed, and begins the transaction.

public void BeginTransaction()

Commit()

Commits the transaction.

public void Commit()

Dispose()

Disposes the transaction and the connection.

public void Dispose()

Rollback()

Rolls back the transaction.

public void Rollback()