ContextUtil.ActivityId Egenskap
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar ett GUID som representerar aktiviteten som innehåller komponenten.
public:
static property Guid ActivityId { Guid get(); };
public static Guid ActivityId { get; }
static member ActivityId : Guid
Public Shared ReadOnly Property ActivityId As Guid
Egenskapsvärde
GUID för en aktivitet om den aktuella kontexten är en del av en aktivitet. annars . GUID_NULL
Undantag
Det finns ingen COM+-kontext tillgänglig.
Exempel
I följande kodexempel hämtas värdet för en ActivityId egenskap.
[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