This documentation is archived and is not being maintained.

TransactionIsolationLevel Enumeration

Specifies the value of the TransactionAttribute.

Namespace:  System.EnterpriseServices
Assembly:  System.EnterpriseServices (in System.EnterpriseServices.dll)

'Declaration
<SerializableAttribute> _
Public Enumeration TransactionIsolationLevel
'Usage
Dim instance As TransactionIsolationLevel

Member nameDescription
AnyThe isolation level for the component is obtained from the calling component's isolation level. If this is the root component, the isolation level used is Serializable.
ReadUncommittedShared locks are issued and no exclusive locks are honored.
ReadCommittedShared locks are held while the data is being read to avoid reading modified data, but the data can be changed before the end of the transaction, resulting in non-repeatable reads or phantom data.
RepeatableReadLocks are placed on all data that is used in a query, preventing other users from updating the data. Prevents non-repeatable reads, but phantom rows are still possible.
SerializablePrevents updating or inserting until the transaction is complete.

The following code example demonstrates the use of the TransactionIsolationLevel type.

Imports System
Imports System.EnterpriseServices
Imports System.Reflection


' References: 
' System.EnterpriseServices 

' An instance of this class will inherit its caller's transaction isolation 
' level if available. If not, it will use isolation level Serializable.
<Transaction(Isolation := TransactionIsolationLevel.Any)>  _
Public Class TransactionAttribute_IsolationAny
    Inherits ServicedComponent
End Class 'TransactionAttribute_IsolationAny

' An instance of this class will read only committed data, but non-repeatable 
' reads and phantom rows are still possible.
<Transaction(Isolation := TransactionIsolationLevel.ReadCommitted)>  _
Public Class TransactionAttribute_IsolationReadCommitted
    Inherits ServicedComponent
End Class 'TransactionAttribute_IsolationReadCommitted

' An instance of this class will read committed and uncommitted data, so dirty 
' reads, non-repeatable reads, and phantom rows are possible.
<Transaction(Isolation := TransactionIsolationLevel.ReadUncommitted)>  _
Public Class TransactionAttribute_IsolationReadUncommitted
    Inherits ServicedComponent
End Class 'TransactionAttribute_IsolationReadUncommitted

' An instance of this class will read only committed data and place shared 
' locks on the data, preventing other users from modifying it, but other users 
' can still insert rows into the data set, so phantom rows are still possible.
<Transaction(Isolation := TransactionIsolationLevel.RepeatableRead)>  _
Public Class TransactionAttribute_IsolationRepeatableRead
    Inherits ServicedComponent
End Class 'TransactionAttribute_IsolationRepeatableRead

' An instance of this class will read only committed data and place a range 
' lock on the data set, preventing other users from updating or inserting rows 
' into the data set until its transaction is complete.
<Transaction(Isolation := TransactionIsolationLevel.Serializable)>  _
Public Class TransactionAttribute_IsolationSerializable
    Inherits ServicedComponent
End Class 'TransactionAttribute_IsolationSerializable

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Show: