Пример #1
0
        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,
                });
            }
        }