Beta 2 of Windows Workflow Foundation includes the new SqlTrackingQuery class (in the System.Workflow.Runtime.Tracking namespace), which allows you to query the tracking records in a SQL Server database inserted by the SqlTrackingService service.

I've written a simple Windows Forms Application that illustrates how to use this basic API and displays the resulting information (well, part of it, as it can be quite a bit) on a simple databinding-based UI. Here's a screenshot:

Something to keep in mind in using this API is that calling SqlTrackingQuery.GetWorkflows() or SqlTrackingQuery.TryGetWorkflow() will attempt to load the original assemblies that defined the workflows for which instances were found in the tracking database. To handle this, the sample simply handles the AppDomain.ResolveAssembly event and provides the user with a simple UI to select the necessary assembly:

You can download the sample here.


Tomas Restrepo

Software developer located in Colombia. Sr. PFE at Microsoft.