Share via


ContextUtil.ActivityId プロパティ

定義

コンポーネントが格納されているアクティビティを表す GUID を取得します。

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

プロパティ値

現在のコンテキストがアクティビティに含まれている場合はアクティビティの GUID。それ以外の場合は GUID_NULL

例外

使用できる COM+ コンテキストはありません。

次のコード例では、 プロパティの値を ActivityId 取得します。

[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

適用対象