Пример #1
0
        public static void LoadFrom(this SubscriptionBusServiceConfigurator configurator, IWindsorContainer container)
        {
            IList <Type> consumerTypes = FindTypes <IConsumer>(container, x => !x.Implements <ISaga>());

            if (consumerTypes.Count > 0)
            {
                var consumerConfigurator = new WindsorConsumerFactoryConfigurator(configurator, container);

                foreach (Type type in consumerTypes)
                {
                    consumerConfigurator.ConfigureConsumer(type);
                }
            }

            IList <Type> sagaTypes = FindTypes <ISaga>(container, x => true);

            if (sagaTypes.Count > 0)
            {
                var sagaConfigurator = new WindsorSagaFactoryConfigurator(configurator, container);

                foreach (Type type in sagaTypes)
                {
                    sagaConfigurator.ConfigureSaga(type);
                }
            }
        }
        static void LoadFrom(
            [NotNull] this SubscriptionBusServiceConfigurator configurator,
            [NotNull] IWindsorContainer container,
            bool useOnlyRegisteredServices)
        {
            if (configurator == null)
            {
                throw new ArgumentNullException("configurator");
            }
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            IList <Type> consumerTypes = container.FindTypes <IConsumer>(x => !x.Implements <ISaga>(), useOnlyRegisteredServices);

            if (consumerTypes.Count > 0)
            {
                var consumerConfigurator = new WindsorConsumerFactoryConfigurator(configurator, container);

                foreach (Type type in consumerTypes)
                {
                    consumerConfigurator.ConfigureConsumer(type);
                }
            }

            IList <Type> sagaTypes = container.FindTypes <ISaga>(x => true, useOnlyRegisteredServices);

            if (sagaTypes.Count > 0)
            {
                var sagaConfigurator = new WindsorSagaFactoryConfigurator(configurator, container);

                foreach (Type type in sagaTypes)
                {
                    sagaConfigurator.ConfigureSaga(type);
                }
            }
        }