Επεξεργασία

Κοινή χρήση μέσω


TrackingProfile.WorkflowTrackPoints Property

Definition

Gets the collection of workflow track points used by the runtime tracking infrastructure to filter workflow status events.

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

Property Value

A WorkflowTrackPointCollection that specifies the points in a workflow instance for which the runtime tracking infrastructure should send a WorkflowTrackingRecord to the tracking service.

Examples

The following code example demonstrates how you can create a TrackingProfile using the TrackingProfile constructor and use the object's properties to help track the execution of a workflow. The example code uses the ActivityTrackPoints, Version, and WorkflowTrackPoints properties.

This code example is part of the Query using SQLTrackingService SDK sample from the Program.cs file. For more information, see Query Using 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

Remarks

A workflow instance emits workflow status events to the runtime tracking infrastructure whenever a TrackingWorkflowEvent occurs indicating that the status of a workflow instance has changed. The runtime tracking infrastructure uses the WorkflowTrackPoints property to filter these workflow status events to determine when to send a WorkflowTrackingRecord to the tracking service. You can add a WorkflowTrackPoint to the WorkflowTrackPoints property to specify points of interest in the potential execution path of the workflow instance for which you want a WorkflowTrackingRecord sent.

A WorkflowTrackPoint does not actually define a physical point in a workflow instance, but instead defines one or more TrackingWorkflowEvent values that can be used by the runtime tracking infrastructure to match workflow status events. Therefore, the same WorkflowTrackPoint can be matched many times during the lifespan of a workflow instance. A WorkflowTrackPoint can also specify any annotations to be returned in the WorkflowTrackingRecord.

Applies to

See also