public static void Trace(Guid workflowInstanceId, WorkflowIdentity workflowDefinitionIdentity, WorkflowInstanceState state)
        {
            WorkflowInstanceTrace trace = new WorkflowInstanceTrace(workflowInstanceId, workflowDefinitionIdentity, state);

            TraceSource ts = new TraceSource("CoreWf.Tracking", SourceLevels.Information);

            ts.TraceData(TraceEventType.Information, 1, trace);
        }
 public override bool Equals(object obj)
 {
     if (obj is WorkflowInstanceTrace trace)
     {
         if (this.InstanceStatus == trace.InstanceStatus &&
             WorkflowInstanceTrace.CompareIdentities(trace.WorkflowDefinitionIdentity, this.WorkflowDefinitionIdentity))
         {
             return(true);
         }
     }
     return(base.Equals(obj));
 }
        bool IActualTraceStep.Equals(IActualTraceStep trace)
        {
            if (trace is WorkflowInstanceTrace instanceTrace)
            {
                if (this.InstanceStatus == instanceTrace.InstanceStatus &&
                    WorkflowInstanceTrace.CompareIdentities(instanceTrace.WorkflowDefinitionIdentity, this.WorkflowDefinitionIdentity))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #4
0
        public ActualTrace(ActualTrace actualTrace)
        {
            lock (actualTrace.Steps)
            {
                foreach (IActualTraceStep step in actualTrace.Steps)
                {
                    ActivityTrace activityTrace = step as ActivityTrace;
                    if (activityTrace != null)
                    {
                        this.Steps.Add(new ActivityTrace(activityTrace));
                        continue;
                    }

                    //WorkflowInstanceUpdatedTrace workflowInstanceUpdatedTrace = step as WorkflowInstanceUpdatedTrace;
                    //if (workflowInstanceUpdatedTrace != null)
                    //{
                    //    this.Steps.Add(new WorkflowInstanceUpdatedTrace(workflowInstanceUpdatedTrace.InstanceName, workflowInstanceUpdatedTrace.OriginalWorkflowIdentity, workflowInstanceUpdatedTrace.WorkflowDefinitionIdentity, workflowInstanceUpdatedTrace.InstanceStatus));
                    //    continue;
                    //}

                    WorkflowInstanceTrace workflowInstanceTrace = step as WorkflowInstanceTrace;
                    if (workflowInstanceTrace != null)
                    {
                        this.Steps.Add(new WorkflowInstanceTrace(workflowInstanceTrace.InstanceName, workflowInstanceTrace.WorkflowDefinitionIdentity, workflowInstanceTrace.InstanceStatus));
                        continue;
                    }

                    UserTrace userTrace = step as UserTrace;
                    if (userTrace != null)
                    {
                        this.Steps.Add(new UserTrace(userTrace.InstanceId, userTrace.ActivityParent, userTrace.Message));
                        continue;
                    }

                    BookmarkResumptionTrace bookmarkResumptionTrace = step as BookmarkResumptionTrace;
                    if (bookmarkResumptionTrace != null)
                    {
                        this.Steps.Add(new BookmarkResumptionTrace(bookmarkResumptionTrace.BookmarkName, bookmarkResumptionTrace.SubinstanceId,
                                                                   bookmarkResumptionTrace.ActivityName));
                        continue;
                    }

                    SynchronizeTrace synchronizeTrace = step as SynchronizeTrace;
                    if (synchronizeTrace != null)
                    {
                        this.Steps.Add(new SynchronizeTrace(synchronizeTrace.userTrace.InstanceId,
                                                            synchronizeTrace.userTrace.Message));
                        continue;
                    }

                    WorkflowExceptionTrace weTrace = step as WorkflowExceptionTrace;
                    if (weTrace != null)
                    {
                        this.Steps.Add(new WorkflowExceptionTrace(weTrace.InstanceName, weTrace.InstanceException));
                        continue;
                    }

                    WorkflowAbortedTrace wasTrace = step as WorkflowAbortedTrace;
                    if (wasTrace != null)
                    {
                        this.Steps.Add(new WorkflowAbortedTrace(wasTrace.InstanceId, wasTrace.AbortedReason));
                        continue;
                    }
                }
            }
        }
예제 #5
0
        //makes a copy of the existing trace group
        public static TraceGroup GetNewTraceGroup(TraceGroup traceGroup)
        {
            TraceGroup newTraceGroup = null;

            if (traceGroup.ordered)
            {
                newTraceGroup = new OrderedTraces();
            }
            else
            {
                newTraceGroup = new UnorderedTraces();
            }

            foreach (WorkflowTraceStep step in traceGroup.Steps)
            {
                ActivityTrace activityTrace = step as ActivityTrace;
                if (activityTrace != null)
                {
                    newTraceGroup.Steps.Add(new ActivityTrace(activityTrace)
                    {
                        Optional = step.Optional
                    });

                    continue;
                }

                WorkflowInstanceTrace workflowInstanceTrace = step as WorkflowInstanceTrace;
                if (workflowInstanceTrace != null)
                {
                    newTraceGroup.Steps.Add(new WorkflowInstanceTrace(workflowInstanceTrace.InstanceName, workflowInstanceTrace.InstanceStatus)
                    {
                        Optional = step.Optional
                    });
                    continue;
                }

                UserTrace userTrace = step as UserTrace;
                if (userTrace != null)
                {
                    newTraceGroup.Steps.Add(new UserTrace(userTrace.InstanceId, userTrace.ActivityParent, userTrace.Message));
                    continue;
                }

                BookmarkResumptionTrace bookmarkResumptionTrace = step as BookmarkResumptionTrace;
                if (bookmarkResumptionTrace != null)
                {
                    newTraceGroup.Steps.Add(new BookmarkResumptionTrace(bookmarkResumptionTrace.BookmarkName,
                                                                        bookmarkResumptionTrace.SubinstanceId, bookmarkResumptionTrace.ActivityName));
                    continue;
                }

                SynchronizeTrace synchronizeTrace = step as SynchronizeTrace;
                if (synchronizeTrace != null)
                {
                    newTraceGroup.Steps.Add(new SynchronizeTrace(synchronizeTrace.userTrace.InstanceId,
                                                                 synchronizeTrace.userTrace.Message));
                    continue;
                }

                ActivityPlaceholderTrace activityPlaceholderTrace = step as ActivityPlaceholderTrace;
                if (activityPlaceholderTrace != null)
                {
                    newTraceGroup.Steps.Add(activityPlaceholderTrace);
                    continue;
                }

                TraceGroup tempTraceGroup = step as TraceGroup;
                if (tempTraceGroup != null)
                {
                    newTraceGroup.Steps.Add(TraceGroup.GetNewTraceGroup(tempTraceGroup));
                    continue;
                }
            }
            return(newTraceGroup);
        }