TransactionAttribute.Timeout Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the time-out for this transaction.
public:
property int Timeout { int get(); void set(int value); };
public int Timeout { get; set; }
member this.Timeout : int with get, set
Public Property Timeout As Integer
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);
}
}
<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
End Class
Produkt | Versions |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET er et åben kildekode projekt. Vælg et link for at give feedback: