private object[] CreateParameters(HandlerStyle handlerStyle, Type commandType, Envelope <ICommand> envelope) { switch (handlerStyle) { case HandlerStyle.Special: return(new object[] { new CommandContext(_resultBus, _repository, envelope), envelope.Body }); case HandlerStyle.Senior: return(new object[] { Convert(commandType, envelope) }); case HandlerStyle.Simple: return(new object[] { envelope.Body }); default: return(new object[0]); } }
public HandlerDescriptor(object handler, Func <Type, MethodInfo> methodFactory, HandlerStyle handlerStyle) { this.target = handler; this.handlerType = handler.GetType(); this.Method = methodFactory(handlerType); this.HandlerStyle = handlerStyle; }