public override object Apply(object component,
                                         object parent,
                                         IReadOnlyDictionary <string, object> parameters)
            {
                var parms = MapParameters(UnderlyingMethod, parent, parameters);

                return(DoAddChild(parent, UnderlyingMethod.Invoke(null, parms)));
            }
Пример #2
0
        /// <summary>
        /// Executes the specified this action on the specified target.
        /// </summary>
        /// <param name="actionMessage">The action message.</param>
        /// <param name="handlingNode">The node.</param>
        /// <param name="context">The context.</param>
        public override void Execute(ActionMessage actionMessage, IInteractionNode handlingNode, object context)
        {
            try
            {
                var parameters = MessageBinder.DetermineParameters(
                    actionMessage,
                    UnderlyingRequirements,
                    handlingNode,
                    context
                    );

                TryUpdateTrigger(actionMessage, handlingNode, true);

                foreach (var filter in UnderlyingFilters.PreProcessors)
                {
                    if (filter.Execute(actionMessage, handlingNode, parameters))
                    {
                        continue;
                    }

                    TryUpdateTrigger(actionMessage, handlingNode, false);
                    return;
                }

                var outcome = new MessageProcessingOutcome(
                    UnderlyingMethod.Invoke(handlingNode.MessageHandler.Unwrap(), parameters),
                    UnderlyingMethod.Info.ReturnType,
                    false
                    );

                foreach (var filter in UnderlyingFilters.PostProcessors)
                {
                    filter.Execute(actionMessage, handlingNode, outcome);
                }

                HandleOutcome(actionMessage, handlingNode, outcome);
            }
            catch (Exception ex)
            {
                TryUpdateTrigger(actionMessage, handlingNode, false);
                if (!TryApplyRescue(actionMessage, handlingNode, ex))
                {
                    Log.Error(ex);
                    throw;
                }
                OnCompleted();
            }
        }
 public override object Apply(object component, object parent, IReadOnlyDictionary <string, object> parameters)
 {
     object[] mappedParameters = MapParameters(UnderlyingMethod, parent, parameters);
     UnderlyingMethod.Invoke(component, mappedParameters);
     return(mappedParameters[0]);
 }
 public override object Apply(object component, object parent, IReadOnlyDictionary <string, object> parameters)
 {
     object[] items = MapParameters(UnderlyingMethod, parent, parameters);
     return(UnderlyingMethod.Invoke(null, items));
 }