CorrelationManager.StartLogicalOperation 方法

定義

啟動執行緒上的邏輯作業。

多載

StartLogicalOperation()

啟動執行緒上的邏輯作業。

StartLogicalOperation(Object)

用執行緒上指定的識別啟動邏輯作業。

StartLogicalOperation()

來源:
CorrelationManager.cs
來源:
CorrelationManager.cs
來源:
CorrelationManager.cs

啟動執行緒上的邏輯作業。

public:
 void StartLogicalOperation();
public void StartLogicalOperation ();
member this.StartLogicalOperation : unit -> unit
Public Sub StartLogicalOperation ()

備註

邏輯作業會針對邏輯作業標識碼使用自動產生的 GUID 來啟動。

適用於

StartLogicalOperation(Object)

來源:
CorrelationManager.cs
來源:
CorrelationManager.cs
來源:
CorrelationManager.cs

用執行緒上指定的識別啟動邏輯作業。

public:
 void StartLogicalOperation(System::Object ^ operationId);
public void StartLogicalOperation (object operationId);
member this.StartLogicalOperation : obj -> unit
Public Sub StartLogicalOperation (operationId As Object)

參數

operationId
Object

識別作業的物件。

例外狀況

operationId 參數為 null

範例

下列程式代碼範例示範如何初始化要與主線程相關聯的邏輯作業,以使用 StartLogicalOperation(Object) 方法。 如需完整的程式代碼範例,請參閱 類別 CorrelationManager

TraceSource ts = new TraceSource("MyApp");
int i = ts.Listeners.Add(new ConsoleTraceListener());
ts.Listeners[i].TraceOutputOptions = TraceOptions.LogicalOperationStack;
ts.Switch = new SourceSwitch("MyAPP", "Verbose");
// Start the logical operation on the Main thread.
Trace.CorrelationManager.StartLogicalOperation("MainThread");
Dim ts As New TraceSource("MyApp")
Dim i As Integer = ts.Listeners.Add(New ConsoleTraceListener())
ts.Listeners(i).TraceOutputOptions = TraceOptions.LogicalOperationStack
ts.Switch = New SourceSwitch("MyAPP", "Verbose")
' Start the logical operation on the Main thread.
Trace.CorrelationManager.StartLogicalOperation("MainThread")

備註

參數 operationId 可以是任何物件,例如 String 允許識別作業以供追蹤之用的 。 所 operationId 代表的物件會加入 至 LogicalOperationStack 屬性。

適用於