public void Execute <TCommand>(TCommand command) where TCommand : IBaseCommand { IBaseCommandHandler <TCommand> handler = IoC.Container.Resolve <IBaseCommandHandler <TCommand> >(); if (handler == null) { throw new CommandHandlerNotFound <TCommand>(); } handler.Handle(command); }
public TResult Dispatch <T, TResult>(T command) where T : Command { IBaseCommandHandler <T, TResult> handler = null; handler = (IBaseCommandHandler <T, TResult>)services.GetService((typeof(AuthorizeCommandHandlerDecorator <T, TResult>))); // handler = (IBaseCommandHandler<T, TResult>)services.GetService((typeof(LoggingHandlerDecorator<T, TResult>))); var logManagement = (ILogManagement)services.GetService(typeof(ILogManagement)); handler = new CatchErrorCommandHandlerDecorator <T, TResult>(new LoggingHandlerDecorator <T, TResult>(handler, logManagement)); return(handler.Handle(command)); }
public CatchErrorCommandHandlerDecorator(IBaseCommandHandler <T, TResult> next) { _next = next; }
public LoggingHandlerDecorator(IBaseCommandHandler <T, TResult> next, ILogManagement log) { _log = log; _next = next; }
public AuthorizeCommandHandlerDecorator(IBaseCommandHandler <T, TResult> next) { _next = next; }