TrackingWorkflowTerminatedEventArgs 类

定义

警告

此 API 现已过时。

包含与工作流实例终止关联的数据。Contains data associated with the termination of a workflow instance.

public ref class TrackingWorkflowTerminatedEventArgs : EventArgs
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
[System.Serializable]
public class TrackingWorkflowTerminatedEventArgs : EventArgs
type TrackingWorkflowTerminatedEventArgs = class
    inherit EventArgs
Public Class TrackingWorkflowTerminatedEventArgs
Inherits EventArgs
继承
TrackingWorkflowTerminatedEventArgs
属性

示例

下面的代码示例演示一个名为 WriteTerminatedEventArgs 的方法,该方法可捕获 TrackingWorkflowTerminatedEventArgsThe following code example demonstrates a method, named WriteTerminatedEventArgs, which captures a TrackingWorkflowTerminatedEventArgs. 代码将检查 Exception 属性是否为 null(在 Visual Basic 中为 Nothing)。The code checks whether the Exception property is null (Nothing in Visual Basic). 如果不是,代码会将与 Exception 属性关联的消息写入控制台。If it is not, the code writes the message associated with the Exception property to the console. 如果 Exceptionnull (Nothing),则代码不会将任何异常信息写入控制台。If Exception is null (Nothing), the code does not write any exception information to the console.

此代码示例摘自 Program.cs 文件中的 EventArgs 跟踪 SDK 示例。This code example is part of the EventArgs Tracking SDK Sample from the Program.cs file. 有关详细信息, 请参阅EventArgs 跟踪示例For more information, see EventArgs Tracking Sample.

static void WriteTerminatedEventArgs(string eventDescription, TrackingWorkflowTerminatedEventArgs terminatedEventArgs, DateTime eventDataTime)
{
    Console.WriteLine("\nTerminated Event Arguments Read From Tracking Database:\n");
    Console.WriteLine("EventDataTime: " + eventDataTime.ToString());
    Console.WriteLine("EventDescription: " + eventDescription);
    if (null != terminatedEventArgs.Exception)
    {
        Console.WriteLine("TerminatedEventArgs Exception Message: " + terminatedEventArgs.Exception.Message.ToString());
    }
}
Shared Sub WriteTerminatedEventArgs(ByVal eventDescription As String, ByVal terminatedEventArgs As TrackingWorkflowTerminatedEventArgs, ByVal eventDataTime As DateTime)
    Console.WriteLine(vbCrLf + "Terminated Event Arguments Read From Tracking Database:")
    Console.WriteLine("EventDataTime: " + eventDataTime.ToString(CultureInfo.CurrentCulture))
    Console.WriteLine("EventDescription: " + eventDescription)
    If terminatedEventArgs.Exception IsNot Nothing Then
        Console.WriteLine("TerminatedEventArgs Exception Message: " + terminatedEventArgs.Exception.Message.ToString())
    End If
End Sub

注解

备注

本材料讨论的类型和命名空间已废弃不用。This material discusses types and namespaces that are obsolete. 有关详细信息,请参阅 Windows Workflow Foundation 4.5 中弃用的类型For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

当工作流实例终止时,运行时跟踪基础结构将生成一个 TrackingWorkflowTerminatedEventArgsA TrackingWorkflowTerminatedEventArgs is generated by the runtime tracking infrastructure when a workflow instance is terminated. 如果与工作流实例关联的 TrackingProfile 包括为 WorkflowTrackPointTerminated 配置的 TrackingWorkflowEvent,工作流跟踪基础结构会将 TrackingWorkflowTerminatedEventArgs 放在 EventArgs 中(位于它发送到跟踪服务的 WorkflowTrackingRecord 中)。If the TrackingProfile associated with a workflow instance includes a WorkflowTrackPoint configured for a TerminatedTrackingWorkflowEvent, the workflow tracking infrastructure puts the TrackingWorkflowTerminatedEventArgs in EventArgs in the WorkflowTrackingRecord that it sends to the tracking service.

工作流实例可能会通过以下三种方式之一终止:宿主可能调用 WorkflowInstance.Terminate;可能会从工作流实例内部调用 TerminateActivity 活动;或者可能会发生未经处理的异常。A workflow instance may be terminated in one of three ways: the host may call WorkflowInstance.Terminate; a TerminateActivity activity may be invoked from inside the workflow instance; or an unhandled exception may occur. 如果工作流被宿主或 TerminateActivity 活动终止,运行时跟踪基础结构会将 Exception 设置为 WorkflowTerminatedException,其 Message 属性设置为终止原因的说明。If the workflow is terminated by the host or a TerminateActivity activity, the runtime tracking infrastructure sets Exception to a WorkflowTerminatedException that has its Message property set to a description of the reason for the termination. 如果工作流由于未经处理的异常而终止,运行时跟踪基础结构将在 Exception 中传递未经处理的异常。If the workflow is terminated because of an unhandled exception, the runtime tracking infrastructure passes the unhandled exception in Exception.

备注

TrackingWorkflowTerminatedEventArgs 仅由运行时跟踪服务使用,以在 WorkflowTrackingRecord 中传递信息。TrackingWorkflowTerminatedEventArgs is used only by the runtime tracking service to pass information in a WorkflowTrackingRecord. WorkflowRuntime.WorkflowTerminated 事件的数据在 WorkflowTerminatedEventArgs 中传递。The data for a WorkflowRuntime.WorkflowTerminated event is passed in a WorkflowTerminatedEventArgs.

属性

Exception

获取导致工作流实例终止的异常。Gets the exception that caused the workflow instance to be terminated.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅