void Run2() { var dispatcher = new Dispatcher1(); dispatcher.Register<SayHelloCommand>( command => GreetingsExecutors .Handle(command, new ConsolePrinterWithTime(new UtcClock(), new ConsolePrinter()))); //................. dispatcher.Dispatch(new SayHelloCommand("Tom")); }
void Run1() { var dispatcher = new Dispatcher1(); dispatcher.Register<SayHelloCommand>( new SayHelloExecutor( new ConsolePrinterWithTime( new UtcClock(), new ConsolePrinter())).Handle); //................. dispatcher.Dispatch(new SayHelloCommand("Tom")); }