public void Publish <T>(T domainEvent) where T : DomainEvent { List <Action <IMessage> > eventHandlers = _routes.GetMessageHandlers(domainEvent.GetType()); if (eventHandlers == null) { return; } foreach (Action <IMessage> currentEventHandler in eventHandlers) { currentEventHandler(domainEvent); } }