public ICommandProcessor Create()
        {
            FillInDefaults();

            var resolutionContext = _container.CreateContext();
            var commandProcessor  = resolutionContext.Get <ICommandProcessor>();

            return(commandProcessor);
        }
        /// <summary>
        /// Registers a <see cref="Views.ViewManagerEventDispatcher"/> to manage the given views. Can be called multiple times in order to register
        /// multiple "pools" of views (each will be managed by a dedicated worker thread).
        /// </summary>
        public ViewManagerEventDispatcherConfiguationBuilder UseViewManagerEventDispatcher(params IViewManager[] viewManagers)
        {
            var viewManagerConfigurationContainer = new ConfigurationContainer();

            UseEventDispatcher(context =>
            {
                var viewManagerContext = viewManagerConfigurationContainer.CreateContext();

                context.AddChildContext(viewManagerContext);

                var eventDispatcher = new ViewManagerEventDispatcher(
                    context.Get <IAggregateRootRepository>(),
                    context.Get <IEventStore>(),
                    context.Get <IDomainEventSerializer>(),
                    context.Get <IDomainTypeNameMapper>(),
                    viewManagers);

                var waitHandle = viewManagerContext.GetOrDefault <ViewManagerWaitHandle>();
                if (waitHandle != null)
                {
                    waitHandle.Register(eventDispatcher);
                }

                var maxDomainEventsPerBatch = viewManagerContext.GetOrDefault <int>();
                if (maxDomainEventsPerBatch > 0)
                {
                    eventDispatcher.MaxDomainEventsPerBatch = maxDomainEventsPerBatch;
                }

                var viewManagerProfiler = viewManagerContext.GetOrDefault <IViewManagerProfiler>();
                if (viewManagerProfiler != null)
                {
                    eventDispatcher.SetProfiler(viewManagerProfiler);
                }

                var contextItems = viewManagerContext.GetOrDefault <IDictionary <string, object> >();
                if (contextItems != null)
                {
                    eventDispatcher.SetContextItems(contextItems);
                }

                var autoDistributionViewManagerEventDispatcher = viewManagerContext.GetOrDefault <AutoDistributionViewManagerEventDispatcher>();
                if (autoDistributionViewManagerEventDispatcher != null)
                {
                    autoDistributionViewManagerEventDispatcher.Register(eventDispatcher);
                    return(autoDistributionViewManagerEventDispatcher);
                }

                return(eventDispatcher);
            });

            return(new ViewManagerEventDispatcherConfiguationBuilder(viewManagerConfigurationContainer));
        }