Exemple #1
0
        /// <summary>
        /// Construct the workflow tracking participant.
        /// </summary>
        /// <returns>Returns the workflow tracking participant.</returns>
        private PSWorkflowTrackingParticipant GetTrackingParticipant()
        {
            const String all = "*";
            PSWorkflowTrackingParticipant participant = new PSWorkflowTrackingParticipant(this._debugger)
            {
                // Create a tracking profile to subscribe for tracking records
                // In this sample the profile subscribes for CustomTrackingRecords,
                // workflow instance records and activity state records
                TrackingProfile = new TrackingProfile()
                {
                    Name = "WorkflowTrackingProfile",
                    Queries = 
                    {
                        new CustomTrackingQuery() 
                        {
                         Name = all,
                         ActivityName = all
                        },
                        new WorkflowInstanceQuery()
                        {
                            // Limit workflow instance tracking records for started and completed workflow states
                            States = { 
                                WorkflowInstanceStates.Started, 
                                WorkflowInstanceStates.Completed, 
                                WorkflowInstanceStates.Persisted, 
                                WorkflowInstanceStates.UnhandledException 
                            },
                        },
                        new ActivityStateQuery()
                        {
                            // Subscribe for track records from all activities for all states
                            ActivityName = all,
                            States = { all },

                            // Extract workflow variables and arguments as a part of the activity tracking record
                            // VariableName = "*" allows for extraction of all variables in the scope
                            // of the activity
                            Variables = 
                            {                                
                                { all }   
                            },

                            Arguments =
                            {
                                { all }
                            }
                        }   
                    }
                }
            };

            return participant;
        }
		private PSWorkflowTrackingParticipant GetTrackingParticipant()
		{
			PSWorkflowTrackingParticipant pSWorkflowTrackingParticipant = new PSWorkflowTrackingParticipant();
			TrackingProfile trackingProfile = new TrackingProfile();
			trackingProfile.Name = "WorkflowTrackingProfile";
			CustomTrackingQuery customTrackingQuery = new CustomTrackingQuery();
			customTrackingQuery.Name = "*";
			customTrackingQuery.ActivityName = "*";
			trackingProfile.Queries.Add(customTrackingQuery);
			WorkflowInstanceQuery workflowInstanceQuery = new WorkflowInstanceQuery();
			workflowInstanceQuery.States.Add("Started");
			workflowInstanceQuery.States.Add("Completed");
			workflowInstanceQuery.States.Add("Persisted");
			workflowInstanceQuery.States.Add("UnhandledException");
			trackingProfile.Queries.Add(workflowInstanceQuery);
			ActivityStateQuery activityStateQuery = new ActivityStateQuery();
			activityStateQuery.ActivityName = "*";
			activityStateQuery.States.Add("*");
			activityStateQuery.Variables.Add("*");
			trackingProfile.Queries.Add(activityStateQuery);
			pSWorkflowTrackingParticipant.TrackingProfile = trackingProfile;
			PSWorkflowTrackingParticipant pSWorkflowTrackingParticipant1 = pSWorkflowTrackingParticipant;
			return pSWorkflowTrackingParticipant1;
		}