Editare

Partajați prin


EventSource.SetCurrentThreadActivityId Method

Definition

Sets the activity ID on the current thread.

Overloads

SetCurrentThreadActivityId(Guid)

Sets the activity ID on the current thread.

SetCurrentThreadActivityId(Guid, Guid)

Sets the activity ID on the current thread, and returns the previous activity ID.

SetCurrentThreadActivityId(Guid)

Source:
EventSource.cs
Source:
EventSource.cs
Source:
EventSource.cs

Sets the activity ID on the current thread.

public:
 static void SetCurrentThreadActivityId(Guid activityId);
public static void SetCurrentThreadActivityId (Guid activityId);
static member SetCurrentThreadActivityId : Guid -> unit
Public Shared Sub SetCurrentThreadActivityId (activityId As Guid)

Parameters

activityId
Guid

The current thread's new activity ID, or Empty to indicate that work on the current thread is not associated with any activity.

Remarks

Calling the SetCurrentThreadActivityId method sets the activity ID on a per-thread basis. All events on the thread will have that activity ID until a new activity is started on the same thread.

This method is called only by libraries that manage their own threads.

Applies to

SetCurrentThreadActivityId(Guid, Guid)

Source:
EventSource.cs
Source:
EventSource.cs
Source:
EventSource.cs

Sets the activity ID on the current thread, and returns the previous activity ID.

public:
 static void SetCurrentThreadActivityId(Guid activityId, [Runtime::InteropServices::Out] Guid % oldActivityThatWillContinue);
public static void SetCurrentThreadActivityId (Guid activityId, out Guid oldActivityThatWillContinue);
static member SetCurrentThreadActivityId : Guid * Guid -> unit
Public Shared Sub SetCurrentThreadActivityId (activityId As Guid, ByRef oldActivityThatWillContinue As Guid)

Parameters

activityId
Guid

The current thread's new activity ID, or Empty to indicate that work on the current thread is not associated with any activity.

oldActivityThatWillContinue
Guid

When this method returns, contains the previous activity ID on the current thread.

Remarks

You can call the SetCurrentThreadActivityId(Guid, Guid) method to temporarily overwrite the current thread's activity ID with a new activity ID. You must then restore the previous activity ID by passing the oldActivityThatWillContinue argument to the SetCurrentThreadActivityId(Guid) method.

Applies to