ContextUtil.IsInTransaction Property

 

Gets a value that indicates whether the current context is transactional.

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

public static bool IsInTransaction { get; }

Property Value

Type: System.Boolean

true if the current context is transactional; otherwise, false.

Exception Condition
COMException

There is no COM+ context available.

The following code example gets the value of a IsInTransaction property.

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

.NET Framework
Available since 1.1
Return to top
Show: