This documentation is archived and is not being maintained.

TrackingProfileSerializer Class

Provides methods to serialize and deserialize tracking profiles into and from XML documents by using the tracking profile XML schema definition (XSD).


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

public class TrackingProfileSerializer

The TrackingProfileSerializer type exposes the following members.

Public methodTrackingProfileSerializerInitializes a new instance of the TrackingProfileSerializer class.

Public propertySchemaGets the tracking profile XML schema definition (XSD).

Public methodDeserializeDeserializes the XML document that is contained in the text reader by using the tracking profile XML Schema definition (XSD).
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 a hash function for a particular type. (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 methodSerializeSerializes the tracking profile into an XML document by using the tracking profile XML Schema definition (XSD).
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

The TrackingProfileSerializer uses the tracking profile XSD contained in TrackingProfileSerializer.Schema to serialize TrackingProfile objects into valid XML documents and to deserialize valid XML documents into TrackingProfile objects. The TrackingProfileSerializer performs validation during both serialization and deserialization and, if necessary, throws an appropriate exception.

An XML document provides a convenient format in which to store a tracking profile. It also provides a non-programmatic way of authoring tracking profiles. The out-of-box SqlTrackingService uses a TrackingProfileSerializer to serialize and deserialize the tracking profiles that are stored in its database.

The following code example demonstrates how you can create a TrackingProfileSerializer using the TrackingProfileSerializer constructor to serialize a TrackingProfile. The code also uses the Serialize method.

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)

    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)

    workflowTrack.MatchingLocation = workflowLocation;

    TrackingProfileSerializer serializer = new TrackingProfileSerializer();
    StringWriter writer = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture);
    serializer.Serialize(writer, profile);
    String trackingprofile = writer.ToString();

.NET Framework

Supported in: 4, 3.5, 3.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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.