Export (0) Print
Expand All

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.

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

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

[SerializableAttribute]
[ObsoleteAttribute("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public class TrackingProfile

The TrackingProfile type exposes the following members.

  NameDescription
Public methodTrackingProfileInitializes a new instance of TrackingProfile.
Top

  NameDescription
Public propertyActivityTrackPointsGets the collection of activity track points used by the runtime tracking infrastructure to filter activity status events.
Public propertyUserTrackPointsGets the collection of user track points used by the runtime tracking infrastructure to filter user events.
Public propertyVersionGets or sets the version of the tracking profile.
Public propertyWorkflowTrackPointsGets the collection of workflow track points used by the runtime tracking infrastructure to filter workflow status events.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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.

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);
}

.NET Framework

Supported in: 4, 3.5, 3.0
Obsolete (compiler warning) in 4.5
Obsolete (compiler warning) in 4.5.1
Obsolete (compiler warning) in 4.5.2

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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