Esempio n. 1
0
        public virtual void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            string workflowDisplayName = "";

            System.ServiceModel.Activities.WorkflowServiceHost workflowServiceHost = serviceHostBase as System.ServiceModel.Activities.WorkflowServiceHost;
            if (null != workflowServiceHost)
            {
                workflowDisplayName = ((System.ServiceModel.Activities.WorkflowServiceHost)serviceHostBase).Activity.DisplayName;
            }

            System.ServiceModel.Activities.WorkflowServiceHost host = serviceHostBase as System.ServiceModel.Activities.WorkflowServiceHost;
            if (this.TrackingComponentElements != null && host != null)
            {
                foreach (TrackingComponentElement trackingComponentElement in this.TrackingComponentElements)
                {
                    TrackingParticipant trackingComponent = this.CreateTrackingComponent(trackingComponentElement);
                    if (trackingComponent != null)
                    {
                        if (!string.IsNullOrEmpty(trackingComponentElement.ProfileName))
                        {
                            trackingComponent.TrackingProfile = this.GetProfile(trackingComponentElement.ProfileName, workflowDisplayName);
                        }

                        host.WorkflowExtensions.Add(trackingComponent);
                    }
                    else
                    {
                        throw new Exception(string.Format("Tracking component is not a known type: {0}", trackingComponentElement.Name));
                    }
                }
            }
        }
Esempio n. 2
0
        GetTrackingParticipantFromJson <TTrackingParticipant>
        (
            string json
            , bool isArray = false
        )
            where TTrackingParticipant : TrackingParticipant, new()
        {
            TrackingParticipant trackingParticipant = null;
            TrackingProfile     trackingProfile
                = GetTrackingProfileFromJson(json, isArray);

            if (trackingProfile != null)
            {
                trackingParticipant = new TTrackingParticipant();
                trackingParticipant.TrackingProfile = trackingProfile;
            }
            return(trackingParticipant);
        }
        public ActualTrace GetActualTrackingData(string trackingParticipantName)
        {
            if (_trackingParticipants == null || _trackingParticipants.Count() == 0)
            {
                return(new ActualTrace());
            }

            TrackingParticipant trackingParticipant = _trackingParticipants[trackingParticipantName];

            if (trackingParticipant is TestTrackingParticipantBase testTrackingParticipant)
            {
                return(testTrackingParticipant.GetActualTrackingData(_workflowId));
            }
            else
            {
                //for sql tracking participant.
                return(null);
            }
        }
Esempio n. 4
0
        public static WorkflowApplication createInstance(string xamlString, Dictionary <string, object> dictionary, TrackingParticipant tracking)
        {
            WorkflowApplication instance = null;

            DynamicActivity dynamicActivity = tool.activityByXaml(xamlString) as DynamicActivity;

            if (dictionary != null)
            {
                instance = new WorkflowApplication(dynamicActivity, dictionary);
            }
            else
            {
                instance = new WorkflowApplication(dynamicActivity);
            }

            instance.Aborted              = aborted;
            instance.Completed            = completed;
            instance.OnUnhandledException = onUnhandledException;
            instance.PersistableIdle      = persistableIdle;
            instance.Unloaded             = unloaded;

            if (tracking != null)
            {
                instance.Extensions.Add(tracking);
            }

            return(instance);
        }