TrackingProfile.Version Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets the version of the tracking profile.

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

public Version Version { get; set; }

Property Value

Type: System.Version

The Version of the TrackingProfile.

Because of the semantics of profile caching in the workflow runtime engine, if you change the contents of a TrackingProfile you must update Version. If you do not, your updated TrackingProfile may not be loaded by the workflow runtime engine, even if it is returned by a call to TrackingService.TryReloadProfile, or sent in the ProfileUpdatedEventArgs associated with a ProfileUpdated event. Therefore, to ensure that the updated TrackingProfile is loaded by the workflow runtime engine, you should change the Version for the TrackingProfile. You can then explicitly call WorkflowInstance.ReloadTrackingProfiles on any appropriate workflow instances, or, depending on your implementation, you can rely on the tracking service to inform the workflow runtime engine of the change. For more information, see TrackingService.

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)

    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
Available since 3.0
Return to top