Export (0) Print
Expand All

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.

ExceptionCondition
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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft