public ICollection <IEventHandler> GetHandlers(Type eventType)
        {
            var eventHandlers = _eventHandlers.GetOrAdd(eventType, type =>
            {
                var handlerTypes = _subscriptionManager.GetEventHandlerTypes(type);
                var handlers     = handlerTypes
                                   .Select(t => (IEventHandler)_serviceProvider.GetServiceOrCreateInstance(t))
                                   .ToArray();
                return(handlers);
            });

            return(eventHandlers);
        }
Ejemplo n.º 2
0
 public static ICollection <Type> GetEventHandlerTypes <TEvent>(this IEventSubscriptionManager subscriptionManager)
     where TEvent : class, IEventBase
 {
     return(subscriptionManager.GetEventHandlerTypes(typeof(TEvent)));
 }