コード例 #1
0
        public static async Task <JToken> ExecuteAsync(this SequenceAction action,
                                                       StateMachineContext context,
                                                       JToken input)
        {
            action.CheckArgNull(nameof(action));
            context.CheckArgNull(nameof(context));
            input.CheckArgNull(nameof(input));

            var output = new JObject();

            for (var idx = 0; idx < action.Actions.Count; idx++)
            {
                var childAction = action.Actions.ElementAt(idx);

                Debug.Assert(childAction != null);

                var id = string.IsNullOrWhiteSpace(childAction.Name) ? idx.ToString() : childAction.Name;

                Debug.Assert(!string.IsNullOrWhiteSpace(id));

                output[id] = await childAction.ExecuteAsync(context, input);
            }

            return(output);
        }