IsolationLevel

This property specifies the isolation level of the local transaction.

Declaration

// C#
public IsolationLevel IsolationLevel {get; set;}

Property Value

IsolationLevel

Exception

InvalidOperationException – The property cannot be set when there's already an existing transaction on the connection or if the connection is already enlisted in a local/distributed transaction.

InvalidArgumentException – The property cannot be set to other IsolationLevels other than IsolationLevel.ReadCommitted or IsolationLevel.Serializable.

System.ObjectDisposedException – This property cannot be accessed after the OracleConnection object is already disposed.

Remarks

By default, this property is set to IsolationLevel.ReadCommitted. It can also be set to IsolationLevel.Serializable.

The application can set this property value before or after the connection is opened. If this property is set during an active transaction, an exception will be thrown.

All implicit transactions have their isolation levels specified on the OracleConnection object.

For explicit transactions, the BeginTransaction() method will use the IsolationLevel specified on the OracleConnection object. When overloaded BeginTransaction(Isolation Level) method is used, its parameter overrides the IsolationLevel setting on the OracleConnection object. Once that transaction commits or rolls back, the connection's isolation level will return to the value set in the OracleConnection IsolationLevel.

Distributed transactions created using TransactionScope do not honor the isolation level set via this property.

After the IsolationLevel property is set, that setting is honored for all subsequent Open() calls on that specific OracleConnection object until the IsolationLevel value is modified.