TrackingProfile.WorkflowTrackPoints 属性

定义

获取运行时跟踪基础结构用于筛选工作流状态事件的工作流跟踪点的集合。

public:
 property System::Workflow::Runtime::Tracking::WorkflowTrackPointCollection ^ WorkflowTrackPoints { System::Workflow::Runtime::Tracking::WorkflowTrackPointCollection ^ get(); };
public System.Workflow.Runtime.Tracking.WorkflowTrackPointCollection WorkflowTrackPoints { get; }
member this.WorkflowTrackPoints : System.Workflow.Runtime.Tracking.WorkflowTrackPointCollection
Public ReadOnly Property WorkflowTrackPoints As WorkflowTrackPointCollection

属性值

一个指定工作流实例中各个点的 WorkflowTrackPointCollection,运行时跟踪基础结构应为该工作流实例将 WorkflowTrackingRecord 发送到跟踪服务。

示例

下面的代码示例演示如何使用 TrackingProfile 构造函数创建 TrackingProfile,以及如何使用对象的属性来帮助跟踪工作流的执行。 该示例代码使用 ActivityTrackPointsVersionWorkflowTrackPoints 属性。

此代码示例摘自 Program.cs 文件中的“使用 SQLTrackingService 查询”SDK 示例。 有关详细信息,请参阅 使用 SQLTrackingService 进行查询

private static void CreateAndInsertTrackingProfile()
{
    TrackingProfile profile = new TrackingProfile();
    ActivityTrackPoint activityTrack = new ActivityTrackPoint();
    ActivityTrackingLocation activityLocation = new ActivityTrackingLocation(typeof(Activity));
    activityLocation.MatchDerivedTypes = true;
    IEnumerable<ActivityExecutionStatus> statuses = Enum.GetValues(typeof(ActivityExecutionStatus)) as IEnumerable<ActivityExecutionStatus>;
    foreach (ActivityExecutionStatus status in statuses)
    {
        activityLocation.ExecutionStatusEvents.Add(status);
    }

    activityTrack.MatchingLocations.Add(activityLocation);
    profile.ActivityTrackPoints.Add(activityTrack);
    profile.Version = version;

    WorkflowTrackPoint workflowTrack = new WorkflowTrackPoint();
    WorkflowTrackingLocation workflowLocation = new WorkflowTrackingLocation();
    IEnumerable<TrackingWorkflowEvent> eventStatuses = Enum.GetValues(typeof(TrackingWorkflowEvent)) as IEnumerable<TrackingWorkflowEvent>;
    foreach (TrackingWorkflowEvent status in eventStatuses)
    {
        workflowLocation.Events.Add(status);
    }

    workflowTrack.MatchingLocation = workflowLocation;
    profile.WorkflowTrackPoints.Add(workflowTrack);

    TrackingProfileSerializer serializer = new TrackingProfileSerializer();
    StringWriter writer = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture);
    serializer.Serialize(writer, profile);
    string trackingprofile = writer.ToString();
    InsertTrackingProfile(trackingprofile);
}
Shared Sub CreateAndInsertTrackingProfile()
    Dim profile As TrackingProfile = New TrackingProfile()

    Dim activityTrack As ActivityTrackPoint = New ActivityTrackPoint()
    Dim activityLocation As ActivityTrackingLocation = New ActivityTrackingLocation(GetType(Activity))
    activityLocation.MatchDerivedTypes = True
    Dim statuses As IEnumerable(Of ActivityExecutionStatus) = CType(System.Enum.GetValues(GetType(ActivityExecutionStatus)), IEnumerable(Of ActivityExecutionStatus))
    For Each status As ActivityExecutionStatus In statuses
        activityLocation.ExecutionStatusEvents.Add(status)
    Next

    activityTrack.MatchingLocations.Add(activityLocation)
    profile.ActivityTrackPoints.Add(activityTrack)
    profile.Version = version

    Dim workflowTrack As WorkflowTrackPoint = New WorkflowTrackPoint()
    Dim workflowLocation As WorkflowTrackingLocation = New WorkflowTrackingLocation()
    Dim eventStatuses As IEnumerable(Of TrackingWorkflowEvent) = CType(System.Enum.GetValues(GetType(TrackingWorkflowEvent)), IEnumerable(Of TrackingWorkflowEvent))
    For Each status As TrackingWorkflowEvent In eventStatuses
        workflowLocation.Events.Add(status)
    Next

    workflowTrack.MatchingLocation = workflowLocation
    profile.WorkflowTrackPoints.Add(workflowTrack)

    Dim serializer As TrackingProfileSerializer = New TrackingProfileSerializer()
    Dim writer As StringWriter = New StringWriter(New StringBuilder(), CultureInfo.InvariantCulture)
    serializer.Serialize(writer, profile)
    Dim trackingProfile As String = writer.ToString()
    InsertTrackingProfile(trackingProfile)
End Sub

注解

当发生指示工作流实例状态已更改的 TrackingWorkflowEvent 时,工作流实例会将工作流状态事件发出到运行时跟踪基础结构。 运行时跟踪基础结构使用 WorkflowTrackPoints 属性筛选这些工作流状态事件,以确定何时将 WorkflowTrackingRecord 发送到跟踪服务。 您可以将 WorkflowTrackPoint 添加到 WorkflowTrackPoints 属性,以指定想要为其发送 WorkflowTrackingRecord 的工作流实例的可能执行路径中的关注点。

WorkflowTrackPoint 不会实际在工作流实例中定义一个物理点,而是会定义一个或多个 TrackingWorkflowEvent 值,运行时跟踪基础结构可以使用这些值来匹配工作流状态事件。 因此,在工作流实例的生存期内,可以匹配同一个 WorkflowTrackPoint 多次。 WorkflowTrackPoint 也可以指定要在 WorkflowTrackingRecord 中返回的任何批注。

适用于

另请参阅