User-Defined State object: UserTrackingRecord
User-Defined State object: UserTrackingRecord is stored in the UserEvents set of SqlTrackingWorkflowInstance as a set Member
For details about how to add user-defined states, see [Tracking _ Adding User-Defined states to Tracking in Activty (4)].
(CODE)
It is not required in the WorkflowRuntime Host Program
Private static void to get the user status (System. Guid instance Id)
{
String SQL = @ "Initial Catalog = Tracking; Data Source = WXWINTER \ SQLEXPRESS; Integrated Security = SSPI ;";
SqlTrackingQuery query = new SqlTrackingQuery (SQL );
The instance that SqlTrackingWorkflowInstance is queried;
Query. TryGetWorkflow (instance Id, out instance to be queried );
Foreach (UserTrackingRecord user status in the instance to be queried. UserEvents)
{
Console. writeLine ("========================================" );
Console. WriteLine ("Activity:" + User status. QualifiedName );
Console. WriteLine ("Activity type:" + User status. ActivityType. ToString ());
Console. WriteLine ("context ID:" + User status. ContextGuid. ToString ());
Console. WriteLine ("time:" + User status. EventDateTime. ToString ());
Console. WriteLine ("content:" + User status. UserData. ToString ());
Console. WriteLine ("EventOrder field value:" + User status. EventOrder. ToString ());
Console. WriteLine ("Parent context ID:" + User status. ParentContextGuid. ToString ());
Try {Console. WriteLine ("key-Value Pair:" + User status. UserDataKey. ToString ());}
Catch {Console. WriteLine ("this does not have a key-value pair! ");}
Console. WriteLine ();
}
}
Running result