Freigeben über


TransactionIsolationLevel-Enumeration

Gibt den Wert des TransactionAttribute an.

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

Syntax

'Declaration
<SerializableAttribute> _
Public Enumeration TransactionIsolationLevel
'Usage
Dim instance As TransactionIsolationLevel
[SerializableAttribute] 
public enum TransactionIsolationLevel
[SerializableAttribute] 
public enum class TransactionIsolationLevel
/** @attribute SerializableAttribute() */ 
public enum TransactionIsolationLevel
SerializableAttribute 
public enum TransactionIsolationLevel

Member

  Membername Beschreibung
Any Der Isolationsgrad für die Komponente wird aus dem Isolationsgrad der aufrufenden Komponente abgerufen. Wenn es sich hierbei um die Stammkomponente handelt, wird als Isolationsgrad Serializable verwendet. 
ReadCommitted Beim Lesen der Daten werden gemeinsame Sperren verwendet, um das Lesen geänderter Daten zu verhindern. Die Daten können jedoch vor dem Ende der Transaktion geändert werden, was zu nicht wiederholbaren Lesevorgängen oder zu Phantomdaten führt. 
ReadUncommitted Es werden gemeinsame Sperren ausgegeben und keine exklusiven Sperren beachtet. 
RepeatableRead Die Sperren gelten für alle in einer Abfrage verwendeten Daten, damit die Daten nicht durch andere Benutzer aktualisiert werden können. Nicht wiederholbare Lesevorgänge werden dadurch verhindert, es sind jedoch weiterhin Phantomzeilen möglich. 
Serializable Verhindert das Aktualisieren oder Einfügen, bis die Transaktion abgeschlossen ist. 

Beispiel

Im folgenden Codebeispiel wird die Verwendung des TransactionIsolationLevel-Typs veranschaulicht.

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
using System;
using System.EnterpriseServices;
using 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 : ServicedComponent
{
}

// 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 : ServicedComponent
{
}

// 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 : ServicedComponent
{
}

// 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 : ServicedComponent
{
}

// 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 : ServicedComponent
{
}
#using <System.EnterpriseServices.dll>

using namespace System;
using namespace System::EnterpriseServices;
using namespace 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 ref class IsolationAny : public ServicedComponent
{
};

// 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 ref class IsolationReadCommitted : public ServicedComponent
{
};

// 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 ref class IsolationReadUncommitted : public ServicedComponent
{
};

// 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 ref class IsolationRepeatableRead : public ServicedComponent
{
};

// 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 ref class IsolationSerializable : public ServicedComponent
{
};
import System.*;
import System.EnterpriseServices.*;
import 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.
/** @attribute Transaction(Isolation = TransactionIsolationLevel.Any)
 */
public class TransactionAttribute_IsolationAny extends ServicedComponent
{
} //TransactionAttribute_IsolationAny

// An instance of this class will read only committed data, but non-repeatable
// reads and phantom rows are still possible.
/** @attribute Transaction(Isolation = TransactionIsolationLevel.ReadCommitted)
 */
public class TransactionAttribute_IsolationReadCommitted 
    extends ServicedComponent
{
} //TransactionAttribute_IsolationReadCommitted

// An instance of this class will read committed and uncommitted data, so dirty
// reads, non-repeatable reads, and phantom rows are possible.
/** @attribute Transaction(Isolation = TransactionIsolationLevel.
    ReadUncommitted)
 */
public class TransactionAttribute_IsolationReadUncommitted 
    extends ServicedComponent
{
} //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.
/** @attribute Transaction(Isolation = TransactionIsolationLevel.
    RepeatableRead)
 */
public class TransactionAttribute_IsolationRepeatableRead 
    extends ServicedComponent
{
} //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.
/** @attribute Transaction(Isolation = TransactionIsolationLevel.Serializable)
 */
public class TransactionAttribute_IsolationSerializable 
    extends ServicedComponent
{
} //TransactionAttribute_IsolationSerializable

Plattformen

Windows 98, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

System.EnterpriseServices-Namespace