public void Raise(IEvent @event) { try { _logger.LogRaised(@event); var handlerType = typeof(IEventHandler <>) .MakeGenericType(@event.GetType()); dynamic handlers = Kernel.GetAll(handlerType); foreach (var handler in handlers) { handler.Handle((dynamic)@event); } _logger.LogHandled(@event); } catch (Exception ex) { _logger.LogException(ex); _dialogService.Show(ex); } }
public TResult Execute <TResult>(IQuery <TResult> query) { try { _logger.LogExecuting(query); var handlerType = typeof(IQueryHandler <,>) .MakeGenericType(query.GetType(), typeof(TResult)); dynamic handler = Kernel.Get(handlerType); var result = handler.Execute((dynamic)query); _logger.LogExecuted(query); return(result); } catch (Exception ex) { _logger.LogException(ex); _dialogService.Show(ex); } return(default(TResult)); }
public void Execute(ICommand command) { try { _logger.LogExecuting(command); var handlerType = typeof(ICommandHandler <>) .MakeGenericType(command.GetType()); dynamic handler = Kernel.Get(handlerType); handler.Execute((dynamic)command); _logger.LogExecuted(command); } catch (Exception ex) { _logger.LogException(ex); _dialogService.Show(ex); } }
public void ShowExceptionDialog(Exception ex) { _exceptionService.Show(ex); }