Tracking_查询用户自定义状态

 

用户自定义状态对象:UserTrackingRecord

用户自定义状态对象:UserTrackingRecord以集合成员的方式存于SqlTrackingWorkflowInstanceUserEvents集合中

用户自定义状态如何添加见[Tracking_在Activty中向Tracking添加用户自定义状态(4)]

(代码)
无须在
WorkflowRuntime宿主程序中

         private   static   void  得到用户状态(System.Guid 实例Id)
        
{
string sql = @"Initial Catalog=Tracking;Data Source=WXWINTER\SQLEXPRESS;Integrated Security=SSPI;";
            SqlTrackingQuery 查询 
= new SqlTrackingQuery(sql);
            SqlTrackingWorkflowInstance 被查询的实例;
            查询.TryGetWorkflow(实例Id, 
out 被查询的实例);

            
foreach (UserTrackingRecord 用户状态 in 被查询的实例.UserEvents)
            
{
                Console.WriteLine(
"====================================");
                Console.WriteLine(
"所属Activity:" +用户状态.QualifiedName);
                Console.WriteLine(
"Activity类型:" + 用户状态.ActivityType.ToString() );
                Console.WriteLine(
"上下文ID:" + 用户状态.ContextGuid.ToString());
                Console.WriteLine(
"时间: " + 用户状态.EventDateTime.ToString());
                Console.WriteLine(
"内容:" + 用户状态.UserData.ToString());
                Console.WriteLine(
"EventOrder字段值:" + 用户状态.EventOrder.ToString());
                Console.WriteLine(
"Parent上下文ID:" + 用户状态.ParentContextGuid.ToString());
                
try { Console.WriteLine("键值对:"+用户状态.UserDataKey.ToString());}
                
catch { Console.WriteLine("该条无键值对!"); }
                
                Console.WriteLine();
            }

        }


运行结果
Tracking_查询用户自定义状态

你可能感兴趣的:(rack)