TransactionAttribute.Timeout Property

 

Gets or sets the time-out for this transaction.

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

public int Timeout { get; set; }

Property Value

Type: System.Int32

The transaction time-out in seconds.

The following code example gets and sets the value of a Transaction attribute's Timeout property.

[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);
    }
}

.NET Framework
Available since 1.1
Return to top
Show: