BeginTransaction()

This method begins a local transaction.

Declaration

// C#
public OracleTransaction BeginTransaction();

Return Value

An OracleTransaction object representing the new transaction.

Implements

IDbConnection

Exceptions

InvalidOperationException - A transaction has already been started.

Remarks

The transaction is created with its isolation level set to its default value of IsolationLevel.ReadCommitted. All further operations related to the transaction must be performed on the returned OracleTransaction object.

If a local transaction is already started implicitly, invoking BeginTransaction() will inherit that transaction.

If the transaction is created explicitly using BeginTransaction(), the transaction can be operated on either through the OracleConnection methods or OracleTransaction methods. But once the transaction is over via a Commit() or a Rollback() invoked on either object, the OracleTransaction cannot be used henceforth.

The BeginTransaction(IsolationLevel) method overrides the OracleConnection IsolationLevel property. Once that transaction commits or rolls back, the connection’s IsolationLevel returns to its previous value.

Auto-commit is disabled when this method is invoked successfully.