예제 #1
0
        /// <summary>
        /// this is a little bit ugly, this code should me moved inside the catalog handler, for
        /// each type discovered the catalog can call initializer.
        /// Actually it simply gets the list of the event handler found on the system, creates each one
        /// with castle and then resolve and call all the domain event handler initializer that were registered
        /// on the system to initialize the handler.
        /// </summary>
        private static void InitializeDomainEventsHandlers()
        {
            IDomainEventHandlerCatalog catalog       = _container.Resolve <IDomainEventHandlerCatalog>();
            IRawEventStore             rawEventStore = _container.Resolve <IRawEventStore>();
            //takes all invoker
            var allHandlers    = catalog.GetAllHandlers();
            var allInitializer = _container.ResolveAll <IDomainEventHandlerInitializer>();

            //cycle on all defining types, we are interested in only
            foreach (var handlerType in allHandlers)
            {
                Object realHandler = _container.Resolve(handlerType);
                foreach (var initializer in allInitializer)
                {
                    initializer.Initialize(realHandler);
                }
                _container.Release(realHandler);
            }
            _container.Release(catalog);
            _container.Release(rawEventStore);
            foreach (var initializer in allInitializer)
            {
                _container.Release(initializer);
            }
        }
 public ReplayableDomainEventHandlerInitializer(
     IDomainEventHandlerCatalog catalog,
     IRawEventStore rawEventStore,
     ILogger logger)
 {
     _catalog = catalog;
     _rawEventStore = rawEventStore;
     _logger = logger;
 }
 public ReplayableDomainEventHandlerInitializer(
     IDomainEventHandlerCatalog catalog,
     IRawEventStore rawEventStore,
     ILogger logger)
 {
     _catalog       = catalog;
     _rawEventStore = rawEventStore;
     _logger        = logger;
 }
 public EventDispatcherToRawStoragePipelineHook(IRawEventStore rawEventStore)
 {
     _rawEventStore = rawEventStore;
 }
 public EventDispatcherToRawStoragePipelineHook(IRawEventStore rawEventStore)
 {
     _rawEventStore = rawEventStore;
 }