Freigeben über


TransactionAttribute.Timeout-Eigenschaft

Ruft das Timeout für diese Transaktion ab oder legt dieses fest.

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

Syntax

'Declaration
Public Property Timeout As Integer
'Usage
Dim instance As TransactionAttribute
Dim value As Integer

value = instance.Timeout

instance.Timeout = value
public int Timeout { get; set; }
public:
property int Timeout {
    int get ();
    void set (int value);
}
/** @property */
public int get_Timeout ()

/** @property */
public void set_Timeout (int value)
public function get Timeout () : int

public function set Timeout (value : int)

Eigenschaftenwert

Das Timeout der Transaktion in Sekunden.

Beispiel

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

<Transaction(Timeout := 30)>  _
Public Class TransactionAttribute_Timeout
    Inherits ServicedComponent
    
    Public Sub TimeoutExample() 
        ' 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 Timeout property.
        MsgBox("TransactionAttribute.Timeout: " & attribute.Timeout)
        
        ' Set the Timeout property value of the attribute to sixty
        ' seconds.
        attribute.Timeout = 60
        
        ' Display the new value of the attribute's Timeout property.
        MsgBox("TransactionAttribute.Timeout: " & attribute.Timeout)
    
    End Sub 'TimeoutExample
End Class 'TransactionAttribute_Timeout
[Transaction(Timeout=30)]
public class TransactionAttribute_Timeout : ServicedComponent
{
    public void TimeoutExample()
    {
        // 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 Timeout property.
        Console.WriteLine("TransactionAttribute.Timeout: {0}",
            attribute.Timeout);

        // Set the Timeout property value of the attribute to sixty
        // seconds.
        attribute.Timeout = 60;

        // Display the new value of the attribute's Timeout property.
        Console.WriteLine("TransactionAttribute.Timeout: {0}",
            attribute.Timeout);
    }
}
/** @attribute Transaction(Timeout = 30)
 */
public class TransactionAttribute_Timeout extends ServicedComponent
{
    public void TimeoutExample()
    {
        // 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 Timeout property.
        Console.WriteLine("TransactionAttribute.Timeout: {0}",
            (System.Int16)attribute.get_Timeout());

        // Set the Timeout property value of the attribute to sixty
        // seconds.
        attribute.set_Timeout(60);

        // Display the new value of the attribute's Timeout property.
        Console.WriteLine("TransactionAttribute.Timeout: {0}", 
            (System.Int16)attribute.get_Timeout());
    } //TimeoutExample
} //TransactionAttribute_Timeout

.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