Редагувати

Поділитися через


ContextUtil.ActivityId Property

Definition

Gets a GUID representing the activity containing the component.

public:
 static property Guid ActivityId { Guid get(); };
public static Guid ActivityId { get; }
static member ActivityId : Guid
Public Shared ReadOnly Property ActivityId As Guid

Property Value

The GUID for an activity if the current context is part of an activity; otherwise, GUID_NULL.

Exceptions

There is no COM+ context available.

Examples

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

[Synchronization(SynchronizationOption::Required)]
public ref class ContextUtil_ActivityId: public ServicedComponent
{
public:
   void Example()
   {
      // Display the ActivityID associated with the current COM+ context.
      Console::WriteLine( "Activity ID: {0}", ContextUtil::ActivityId );
   }
};
[Synchronization(SynchronizationOption.Required)]
public class ContextUtil_ActivityId : ServicedComponent
{
    public void Example()
    {
        // Display the ActivityID associated with the current COM+ context.
        Console.WriteLine("Activity ID: {0}", ContextUtil.ActivityId);
    }
}
<Synchronization(SynchronizationOption.Required)>  _
Public Class ContextUtil_ActivityId
    Inherits ServicedComponent
    
    Public Sub Example() 
        ' Display the ActivityID associated with the current COM+ context.
        MsgBox("Activity ID: " & ContextUtil.ActivityId.ToString())

    End Sub
End Class

Applies to