Beispiel #1
0
        public object[] Bind <TMsg>(TMsg message, Delegate messageInitializer)
        {
            ParameterInfo[] destinationArguments = messageInitializer.Method.GetParameters();

            if (destinationArguments.Length == 0)
            {
                return new object[] { }
            }
            ;

            var argumentValues = new List <object> {
                message
            };

            if (destinationArguments[0].ParameterType != typeof(TMsg))
            {
                throw new InvalidOperationException("The first parameter of the delegate must be the message to initialize");
            }

            var mapper = new MapInputArgumentHeuristic(_serviceMethod, messageInitializer, 1);

            argumentValues.AddRange(mapper.Map(_invocationArguments));

            return(argumentValues.ToArray());
        }
    }
 public object Produce(object[] arguments)
 {
     return(_returnValue.DynamicInvoke(_mapper.Map(arguments).ToArray()));
 }
 public void Call(object[] arguments)
 {
     _returnValue.DynamicInvoke(_mapper.Map(arguments).ToArray());
 }