IsolationLevel Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the isolation level of a transaction.
public enum class IsolationLevel
public enum IsolationLevel
type IsolationLevel =
Public Enum IsolationLevel
- Inheritance
Fields
Chaos | 5 | The pending changes from more highly isolated transactions cannot be overwritten. |
ReadCommitted | 2 | Volatile data cannot be read during the transaction, but can be modified. |
ReadUncommitted | 3 | Volatile data can be read and modified during the transaction. |
RepeatableRead | 1 | Volatile data can be read but not modified during the transaction. New data can be added during the transaction. |
Serializable | 0 | Volatile data can be read but not modified, and no new data can be added during the transaction. |
Snapshot | 4 | Volatile data can be read. Before a transaction modifies data, it verifies if another transaction has changed the data after it was initially read. If the data has been updated, an error is raised. This allows a transaction to get to the previously committed value of the data. When you try to promote a transaction that was created with the |
Unspecified | 6 | A different isolation level than the one specified is being used, but the level cannot be determined. An exception is thrown if this value is set. |
Remarks
The data affected by a transaction is called volatile. When you create a transaction, you can specify the isolation level that applies to the transaction. The isolation level of a transaction determines what level of access other transactions have to volatile data before a transaction completes.
The lowest isolation level, ReadUncommitted
, allows many transactions to operate on a data store simultaneously and provides no protection against data corruption due to interruptive transactions. The highest isolation level, Serializable
, provides a high degree of protection against interruptive transactions, but requires that each transaction complete before any other transactions are allowed to operate on the data.
The isolation level of a transaction is determined when the transaction is created. By default, the System.Transactions infrastructure creates Serializable
transactions. You can determine the isolation level of an existing transaction by using the Transaction.IsolationLevel property of a transaction.