public void Send(ICommand command) { _mailbox.Insert(command); var handler = _commandToHandlerMapping[command.GetType()]; var instance = (dynamic)Activator.CreateInstance(handler, _reportCommandExecution); instance.Handle((dynamic)command); }
public ICommand AttachTo(ICommand command) { if (command == null) { throw new ArgumentNullException(nameof(command)); } var envelope = new Envelope(command); _mailbox.Insert(envelope); return(envelope); }