TrackingProfile Class

 
Note: This API is now obsolete.

Defines points of interest in the potential execution path of a root workflow instance about which a tracking service should be notified.

Namespace:   System.Workflow.Runtime.Tracking
Assembly:  System.Workflow.Runtime (in System.Workflow.Runtime.dll)

System.Object
  System.Workflow.Runtime.Tracking.TrackingProfile

<SerializableAttribute>
<ObsoleteAttribute("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")>
Public Class TrackingProfile

NameDescription
System_CAPS_pubmethodTrackingProfile()

Initializes a new instance of TrackingProfile.

NameDescription
System_CAPS_pubpropertyActivityTrackPoints

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

System_CAPS_pubpropertyUserTrackPoints

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

System_CAPS_pubpropertyVersion

Gets or sets the version of the tracking profile.

System_CAPS_pubpropertyWorkflowTrackPoints

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

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_noteNote

This material discusses types and namespaces that are obsolete. For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

During its run time, a workflow instance emits tracking events to the runtime tracking infrastructure. The runtime tracking infrastructure uses a TrackingProfile to filter these tracking events and returns tracking records based on this filtering to a tracking service. There are three kinds of tracking events that can be filtered: activity status events, workflow status events, and user events. You can add ActivityTrackPoint objects to the ActivityTrackPoints property to match specific activity status events; WorkflowTrackPoint objects to the WorkflowTrackPoints property to match specific workflow status events; and UserTrackPoint objects to the UserTrackPoints property to match specific user events. When a track point is matched, the runtime tracking infrastructure returns the data associated with the tracking event to the tracking service over the TrackingChannel associated with that service. The data is returned in either an ActivityTrackingRecord, a WorkflowTrackingRecord, or a UserTrackingRecord depending on the type of track point that was matched.

A tracking service implements the methods in the abstract TrackingService class to provide the functionality for the runtime tracking infrastructure to request a TrackingChannel associated with the service, and a TrackingProfile associated with a particular workflow instance or with a particular workflow type. A tracking service must also implement the abstract TrackingChannel class to provide the channel over which the runtime tracking infrastructure can send tracking records.

When the tracking service returns a tracking profile object to the runtime, the workflow starts to execute, and the tracking profile is serialized. If the serialization of the tracking profile fails, an exception is raised to the workflow instance. If the exception is not handled, the workflow instance is terminated. The tracking profile can be validated before passing it to the runtime using the Schema property.

A TrackingProfile can be serialized to XML by using the TrackingProfileSerializer, which formats the XML according to the Schema. This provides a convenient format for profile storage and for authoring a profile in a non-programmatic manner. For example, the SQL Tracking Service stores serialized versions of its tracking profiles, as will any tracking service you create based on the SqlTrackingService class.

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.

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

.NET Framework
Available since 3.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: