Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Class TransactionScope

Ensures transaction to database operations

Inheritance
System.Object
TransactionScope
Implements
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.Data.Provider
Assembly: Mediachase.DataProvider.dll
Version: 13.30.0
Syntax
public class TransactionScope : DataTransaction, IDisposable
Remarks

Default implementation of DataTransaction that works with System.Data.IDbConnection.

Constructors

TransactionScope()

Declaration
public TransactionScope()

TransactionScope(ReadonlyModeValidator)

Declaration
public TransactionScope(ReadonlyModeValidator readOnlyHandler)
Parameters
Type Name Description
ReadonlyModeValidator readOnlyHandler

Methods

Commit()

Declaration
public override void Commit()
Overrides

Complete()

Declaration
public void Complete()

Dispose()

Declaration
public override sealed void Dispose()
Overrides

Dispose(Boolean)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

OnCommit(Action)

Runs an action when the current transaction is committed, or immediately if a transaction is not in progress.

Declaration
public static void OnCommit(Action action)
Parameters
Type Name Description
System.Action action

The action to execute.

OnCommit(Action, TransactionScope.ExecutionOrder)

Runs an action when the current transaction is committed, or immediately if a transaction is not in progress.

Declaration
public static void OnCommit(Action action, TransactionScope.ExecutionOrder executionOrder)
Parameters
Type Name Description
System.Action action

The action to execute.

TransactionScope.ExecutionOrder executionOrder

The execution order. if First the action will execute before any action registered using Second

OpenConnection(IDbCommand, String, TransactionScope.ConnectionDelegate)

Assigns a connection and a transaction to the specified database command. The connection and transaction will be reused if there is a transaction in progress on the specified database.

Declaration
public static bool OpenConnection(IDbCommand cmd, string connectionString, TransactionScope.ConnectionDelegate connectionFactory)
Parameters
Type Name Description
System.Data.IDbCommand cmd

The database command.

System.String connectionString

The connection string of the target database.

TransactionScope.ConnectionDelegate connectionFactory

A delegate for creating database connections.

Returns
Type Description
System.Boolean

True if a new connection was created, otherwise false.

Remarks

If true is returned, the caller will be reponsible for closing the database connection.

RunOnCommit(Action)

Declaration
public override void RunOnCommit(Action action)
Parameters
Type Name Description
System.Action action
Overrides

Implements

System.IDisposable