ContextUtil.IsInTransaction Vlastnost
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Získá hodnotu, která označuje, zda aktuální kontext je transakční.
public:
static property bool IsInTransaction { bool get(); };
public static bool IsInTransaction { get; }
static member IsInTransaction : bool
Public Shared ReadOnly Property IsInTransaction As Boolean
Hodnota vlastnosti
truepokud je aktuální kontext transakční; v opačném případě . false
Výjimky
Není k dispozici žádný kontext modelu COM+.
Příklady
Následující příklad kódu získá hodnotu IsInTransaction vlastnosti.
[Transaction(TransactionOption::Required)]
public ref class ContextUtil_IsInTransaction: public ServicedComponent
{
public:
void Example()
{
// Display whether the current COM+ context is enlisted in a
// transaction.
Console::WriteLine( "Current context enlisted in transaction: {0}",
ContextUtil::IsInTransaction );
}
};
[Transaction(TransactionOption.Required)]
public class ContextUtil_IsInTransaction : ServicedComponent
{
public void Example()
{
// Display whether the current COM+ context is enlisted in a
// transaction.
Console.WriteLine("Current context enlisted in transaction: {0}",
ContextUtil.IsInTransaction);
}
}
<Transaction(TransactionOption.Required)> _
Public Class ContextUtil_IsInTransaction
Inherits ServicedComponent
Public Sub Example()
' Display whether the current COM+ context is enlisted in a
' transaction.
MsgBox("Current context enlisted in transaction: " & ContextUtil.IsInTransaction)
End Sub
End Class