Exemple #1
0
        void OnChildServiceRequested(int stepNumber, int attemptNumber, SettingsCollection options)
        {
            // Get the step configuration elements
            WorkflowStepElement           stepConfig   = this.Configuration.Workflow[stepNumber];
            AccountServiceSettingsElement stepSettings =
                this.Configuration.StepSettings != null ?
                this.Configuration.StepSettings[stepConfig] :
                null;

            // Take the step configuration
            ActiveServiceElement configuration = stepSettings != null ?
                                                 new ActiveServiceElement(stepSettings) :
                                                 new ActiveServiceElement(stepConfig);

            // Add child-specific options
            if (options != null)
            {
                configuration.Options.Merge(options);
            }

            // Add parent options, without overriding child options with the same name
            foreach (var parentOption in this.Configuration.Options)
            {
                if (!configuration.Options.ContainsKey(parentOption.Key))
                {
                    configuration.Options.Add(parentOption.Key, parentOption.Value);
                }
            }

            // Add parent extensions, without overriding child options with the same name
            foreach (var parentExtension in this.Configuration.Extensions)
            {
                if (!configuration.Extensions.ContainsKey(parentExtension.Key))
                {
                    configuration.Extensions.Add(parentExtension.Key, parentExtension.Value);
                }
            }

            // Generate a child instance
            ServiceInstance child = Service.CreateInstance(configuration, this, this.AccountID);

            child.StateChanged     += _childStateHandler;
            child.OutcomeReported  += _childOutcomeHandler;
            child.ProgressReported += _childProgressHandler;
            _childServices.Add(child, stepNumber);

            if (ChildServiceRequested != null)
            {
                ChildServiceRequested(this, new ServiceRequestedEventArgs(child, attemptNumber));
            }
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        protected virtual void RequestChildService(int stepNumber, int attemptNumber, SettingsCollection options = null)
        {
            List <IServiceSubscriber> subscribers;

            if (!_subscribers.TryGetValue(ServiceEventType.ChildServiceRequested, out subscribers))
            {
                return;
            }

            foreach (IServiceSubscriber subscriber in subscribers)
            {
                subscriber.ChildServiceRequested(stepNumber, attemptNumber, options);
            }
        }
Exemple #3
0
 void IServiceSubscriber.ChildServiceRequested(int stepNumber, int attemptNumber, SettingsCollection options)
 {
     OnChildServiceRequested(stepNumber, attemptNumber, options);
 }