Freigeben über


TransactionAttribute.Isolation-Eigenschaft

Ruft den Transaktionsisolationsgrad ab oder legt diesen fest.

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

Syntax

'Declaration
Public Property Isolation As TransactionIsolationLevel
'Usage
Dim instance As TransactionAttribute
Dim value As TransactionIsolationLevel

value = instance.Isolation

instance.Isolation = value
public TransactionIsolationLevel Isolation { get; set; }
public:
property TransactionIsolationLevel Isolation {
    TransactionIsolationLevel get ();
    void set (TransactionIsolationLevel value);
}
/** @property */
public TransactionIsolationLevel get_Isolation ()

/** @property */
public void set_Isolation (TransactionIsolationLevel value)
public function get Isolation () : TransactionIsolationLevel

public function set Isolation (value : TransactionIsolationLevel)

Eigenschaftenwert

Einer der TransactionIsolationLevel-Werte.

Beispiel

Im folgenden Codebeispiel wird der Wert der Isolation-Eigenschaft eines Transaction-Attributs abgerufen und festgelegt.

<Transaction(Isolation := TransactionIsolationLevel.Serializable)>  _
Public Class TransactionAttribute_Isolation
    Inherits ServicedComponent
    
    Public Sub IsolationExample() 
        ' Get the TransactionAttribute applied to the class.
        Dim attribute As TransactionAttribute = CType(Attribute.GetCustomAttribute(Me.GetType(), GetType(TransactionAttribute), False), TransactionAttribute)
        
        ' Display the current value of the attribute's Isolation property.
        MsgBox("TransactionAttribute.Isolation: " & attribute.Isolation)
        
        ' Set the Isolation property value of the attribute.
        attribute.Isolation = TransactionIsolationLevel.RepeatableRead
        
        ' Display the new value of the attribute's Isolation property.
        MsgBox("TransactionAttribute.Isolation: " & attribute.Isolation)
    
    End Sub 'IsolationExample
End Class 'TransactionAttribute_Isolation
[Transaction(Isolation=TransactionIsolationLevel.Serializable)]
public class TransactionAttribute_Isolation : ServicedComponent
{
    public void IsolationExample()
    {
        // Get the TransactionAttribute applied to the class.
        TransactionAttribute attribute =
            (TransactionAttribute)Attribute.GetCustomAttribute(
            this.GetType(),
            typeof(TransactionAttribute),
            false);

        // Display the current value of the attribute's Isolation property.
        Console.WriteLine("TransactionAttribute.Isolation: {0}",
            attribute.Isolation);

        // Set the Isolation property value of the attribute.
        attribute.Isolation = TransactionIsolationLevel.RepeatableRead;

        // Display the new value of the attribute's Isolation property.
        Console.WriteLine("TransactionAttribute.Isolation: {0}",
            attribute.Isolation);
    }
}
/** @attribute Transaction(Isolation = TransactionIsolationLevel.Serializable)
 */
public class TransactionAttribute_Isolation extends ServicedComponent
{
    public void IsolationExample()
    {
        // Get the TransactionAttribute applied to the class.
        TransactionAttribute attribute = (TransactionAttribute)(
            Attribute.GetCustomAttribute(this.GetType(),
            TransactionAttribute.class.ToType(), false));

        // Display the current value of the attribute's Isolation property.
        Console.WriteLine("TransactionAttribute.Isolation: {0}",
            attribute.get_Isolation());

        // Set the Isolation property value of the attribute.
        attribute.set_Isolation(TransactionIsolationLevel.RepeatableRead);

        // Display the new value of the attribute's Isolation property.
        Console.WriteLine("TransactionAttribute.Isolation: {0}",
            attribute.get_Isolation());
    } //IsolationExample
} //TransactionAttribute_Isolation

.NET Framework-Sicherheit

  • Volle Vertrauenswürdigkeit für den unmittelbaren Aufrufer. Dieser Member kann von nur teilweise vertrauenswürdigem Code nicht verwendet werden. Weitere Informationen finden Sie unter .

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

TransactionAttribute-Klasse
TransactionAttribute-Member
System.EnterpriseServices-Namespace