Class TransactionScope
Inheritance
Implements
Inherited Members
Namespace: Mediachase.Data.Provider
Assembly: Mediachase.DataProvider.dll
Version: 10.8.0Syntax
public class TransactionScope : IDisposable
Constructors
TransactionScope()
Declaration
public TransactionScope()
Methods
Complete()
Declaration
public void Complete()
Dispose()
Declaration
public void Dispose()
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.