ContextUtil.ActivityId 属性
定义
获取一个 GUID,它表示包含组件的活动。Gets a GUID representing the activity containing the component.
public:
static property Guid ActivityId { Guid get(); };
public static Guid ActivityId { get; }
member this.ActivityId : Guid
Public Shared ReadOnly Property ActivityId As Guid
属性值
如果当前上下文是某个活动的一部分,则为该活动的 GUID;否则为 GUID_NULL。The GUID for an activity if the current context is part of an activity; otherwise, GUID_NULL.
例外
没有可用的 COM+ 上下文。There is no COM+ context available.
示例
下面的代码示例获取属性的值 ActivityId 。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