public ActionResult Exec(IActionContext context) { List <Dictionary <string, object> > res = new List <Dictionary <string, object> >(); for (int i = 0, val = Start; i < Count; i++, val += Step) { using (var newcontext = context.BeginContext()) { if (!string.IsNullOrEmpty(ItemName)) { newcontext.Vars[ItemName] = val; } ChainUtility.Run(this.Entry, newcontext); res.Add(context.GetContextValues()); } } return(new ActionResult(res)); }
public ActionResult Exec(IActionContext context) { List <Dictionary <string, object> > res = new List <Dictionary <string, object> >(); if (Source != null) { foreach (var item in Source) { using (var newcontext = context.BeginContext()) { if (!string.IsNullOrEmpty(ItemName)) { newcontext.Vars[ItemName] = item; } ChainUtility.Run(this.Entry, newcontext); res.Add(context.GetContextValues()); } } } return(new ActionResult(res)); }
private static ActionResult RunStep(ActionChain chain, IActionContext context) { var factory = context.GetService <IActionFactory>(); var trace = context.GetService <IActionTraceService>(); try { var action = factory.GetAction(chain.ActionRef); if (action.Action is IChainEntry) { (action.Action as IChainEntry).Entry = chain.SubEntry; } var inputValues = ActionUtility.GetInputArguments(action, chain.Inputs, context); if (action.Meta.Kind == ActionKind.Workflow) { using (var newcontext = context.BeginContext()) { ActionUtility.SetInputArguments(action, inputValues, newcontext); var res = action.Action.Exec(newcontext); return(res); } } else { ActionUtility.SetInputArguments(action, inputValues, context); var res = action.Action.Exec(context); return(res); } } catch (Exception ex) { return(new ActionResult() { Error = ex, IsSuccess = false, }); } }