ContextUtil.TransactionId Property

 

Gets the GUID of the current COM+ DTC transaction.

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

public static Guid TransactionId { get; }

Property Value

Type: System.Guid

A GUID representing the current COM+ DTC transaction, if one exists.

Exception Condition
COMException

There is no COM+ context available.

PlatformNotSupportedException

The platform is not Windows 2000 or later.

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

[Transaction(TransactionOption.Required)]
public class ContextUtil_TransactionId : ServicedComponent
{
    public void Example()
    {
        // Display the ID of the transaction in which the current COM+ context
        // is enlisted.
        Console.WriteLine("Transaction ID: {0}", ContextUtil.TransactionId);
    }
}

.NET Framework
Available since 1.1
Return to top
Show: