次の方法で共有


TrackingChannel.Send(TrackingRecord) メソッド

定義

派生クラスで実装された場合、TrackingRecord 上に TrackingChannel を送出します。

protected public:
 abstract void Send(System::Workflow::Runtime::Tracking::TrackingRecord ^ record);
protected internal abstract void Send (System.Workflow.Runtime.Tracking.TrackingRecord record);
abstract member Send : System.Workflow.Runtime.Tracking.TrackingRecord -> unit
Protected Friend MustOverride Sub Send (record As TrackingRecord)

パラメーター

record
TrackingRecord

送信する TrackingRecord

Send メソッドの実装例を次に示します。 この実装では、ワークフローの終了時に追跡メッセージがイベント ログに書き込まれます。 このサンプルは、終了追跡サービスの SDK サンプルです。 詳細については、「 終了追跡サービスのサンプル」を参照してください。

/// <summary>
/// Receives tracking events.  Instance terminated events are written to the event log.
/// </summary>
protected override void Send(TrackingRecord record)
{
    WorkflowTrackingRecord instanceTrackingRecord = record as WorkflowTrackingRecord;

    if ((null == instanceTrackingRecord) || (TrackingWorkflowEvent.Terminated != instanceTrackingRecord.TrackingWorkflowEvent))
        return;

    // Create an EventLog instance and assign its source.
    EventLog log = new EventLog();
    log.Source = sourceValue;

    // Write an informational entry to the event log.
    TrackingWorkflowTerminatedEventArgs terminatedEventArgs = instanceTrackingRecord.EventArgs as TrackingWorkflowTerminatedEventArgs;

    StringBuilder message = new StringBuilder(512);
    message.AppendLine(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Workflow instance {0} has been terminated.", parametersValue.InstanceId.ToString()));
    message.AppendLine();

    if (null != terminatedEventArgs.Exception)
        message.AppendLine(terminatedEventArgs.Exception.ToString());

    log.WriteEntry(message.ToString(), EventLogEntryType.Warning);
}
'/ <summary>
'/ Receives tracking events.  Instance terminated events are written to the event log.
'/ </summary>
Protected Overrides Sub Send(ByVal record As TrackingRecord)

    Dim instanceTrackingRecord As WorkflowTrackingRecord = CType(record, WorkflowTrackingRecord)

    If instanceTrackingRecord Is Nothing Or Not TrackingWorkflowEvent.Terminated = instanceTrackingRecord.TrackingWorkflowEvent Then
        Return
    End If

    ' Create an EventLog instance and assign its source.
    Dim log As New EventLog()
    log.Source = sourceValue

    ' Write an informational entry to the event log.  
    Dim terminatedEventArgs As TrackingWorkflowTerminatedEventArgs = CType(instanceTrackingRecord.EventArgs, TrackingWorkflowTerminatedEventArgs)

    Dim Message As New StringBuilder(512)
    Message.AppendLine(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Workflow instance 0} has been terminated.", parametersValue.InstanceId.ToString()))
    Message.AppendLine()

    If terminatedEventArgs.Exception Is Nothing Then
        Message.AppendLine(terminatedEventArgs.Exception.ToString())
    End If


    log.WriteEntry(Message.ToString(), EventLogEntryType.Warning)
End Sub

注釈

Send 内の追跡ポイントを照合するとき、ランタイム追跡インフラストラクチャは TrackingRecord 上に TrackingChannel を送出するために TrackingProfile を呼び出します。 TrackingChannel 上に送られる追跡情報は、アプリケーションの必要に応じて任意の方法で扱うことができます。

適用対象