ContextUtil.TransactionId Property

Definition

Gets the GUID of the current COM+ DTC transaction.

C#
public static Guid TransactionId { get; }

Property Value

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

Exceptions

There is no COM+ context available.

Examples

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

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

Applies to

Proizvod Verzije
.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