Exemple #1
0
        protected virtual void RunConcurrent(IActionContext context, IEnumerable <int> values)
        {
            IIdGenService          idGenService          = context.GetRequiredService <IIdGenService>();
            IActionExecuterService actionExecuterService = context.GetRequiredService <IActionExecuterService>();
            var allTasks = values.Select(p => RunStep(context, p, idGenService, actionExecuterService)).ToArray();

            Task.WaitAll(allTasks);
        }
Exemple #2
0
        protected virtual void RunOneByOne(IActionContext context, IEnumerable <int> values)
        {
            IIdGenService          idGenService          = context.GetRequiredService <IIdGenService>();
            IActionExecuterService actionExecuterService = context.GetRequiredService <IActionExecuterService>();

            foreach (var val in values ?? Enumerable.Empty <int>())
            {
                RunStep(context, val, idGenService, actionExecuterService).Wait();
            }
        }
Exemple #3
0
        protected void RunOneByOne(IActionContext context, ICollection source)
        {
            IIdGenService          idGenService          = context.GetRequiredService <IIdGenService>();
            IActionExecuterService actionExecuterService = context.GetRequiredService <IActionExecuterService>();
            int index = this.StartIndex;

            foreach (var item in source ?? Array.Empty <object>())
            {
                RunStep(context, index++, item, idGenService, actionExecuterService).Wait();
            }
        }
Exemple #4
0
        protected void RunConcurrent(IActionContext context, ICollection source)
        {
            IIdGenService          idGenService          = context.GetRequiredService <IIdGenService>();
            IActionExecuterService actionExecuterService = context.GetRequiredService <IActionExecuterService>();
            int index    = this.StartIndex;
            var allTasks = new List <Task>();

            foreach (var item in source ?? Array.Empty <object>())
            {
                var task = RunStep(context, index++, item, idGenService, actionExecuterService);
                allTasks.Add(task);
            }
            Task.WaitAll(allTasks.ToArray());
        }
Exemple #5
0
        protected override object RunInternal(IActionContext context)
        {
            IGroupRunnerService groupRunnerService = context.GetRequiredService <IGroupRunnerService>();

            groupRunnerService.RunGroup(context, this.SubGroup).Wait();
            return(null);
        }
        public object Run(IActionContext context)
        {
            _ = context ?? throw new ArgumentNullException(nameof(context));
            IOptions <WorkflowOption> option = context.GetRequiredService <IOptions <WorkflowOption> >();

            this.SubGroup = context.Parameters.Vars[option.Value.SubEntryActionVarName] as GroupInfo;
            return(RunInternal(context));
        }
 public object Run(IActionContext context)
 {
     var groupRunnerService = context.GetRequiredService<IGroupRunnerService>();
     var dynamicValueService = context.GetRequiredService<IDynamicValueService>();
     var publishValueService = context.GetRequiredService<IPublishValueService>();
     this.PublishGlobalVars(context, publishValueService);
     try
     {
         this.RunSetup(context, groupRunnerService).Wait();
         this.RunBody(context, groupRunnerService).Wait();
         return this.ParseResult(context, dynamicValueService);
     }
     finally
     {
         this.RunTeardown(context, groupRunnerService).Wait();
     }
 }
        public virtual object Run(IActionContext context)
        {
            var executerService = context.GetRequiredService <IActionExecuterService>();
            var execContext     = this.OnCreateExecuteContext(context);
            var task            = executerService.Execute(execContext);

            Task.WaitAll(task);
            if (task.Result.ExecuteError != null)
            {
                throw task.Result.ExecuteError;
            }
            return(this.OnHandlerResult(task.Result.Result));
        }