コード例 #1
0
 private void HandleEvent <TEvent>(TEvent @event) where TEvent : IEvent
 {
     if (EventSubscriberProvider != null)
     {
         var eventSubscriberTypes = EventSubscriberProvider.GetHandlerTypes(@event.GetType());
         eventSubscriberTypes.ForEach(eventSubscriberType =>
         {
             var eventSubscriber = Container.Resolve(eventSubscriberType.Type);
             ((dynamic)eventSubscriber).Handle((dynamic)@event);
         });
     }
 }
コード例 #2
0
ファイル: EventBus.cs プロジェクト: ddd-cqrs-es/IFramework
 public void Publish <TEvent>(TEvent @event) where TEvent : IEvent
 {
     EventQueue.Add(@event);
     if (EventSubscriberProvider != null)
     {
         var eventSubscriberTypes = EventSubscriberProvider.GetHandlerTypes(@event.GetType());
         eventSubscriberTypes.ForEach(eventSubscriberType =>
         {
             var eventSubscriber = Container.Resolve(eventSubscriberType.Type);
             ((dynamic)eventSubscriber).Handle((dynamic)@event);
         });
     }
 }