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);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Add sagas that were already added to the container to the registration
        /// </summary>
        public static void AddSagasFromContainer(this IRegistrationConfigurator configurator, IWindsorContainer container)
        {
            var sagaTypes = container.FindTypes(TypeMetadataCache.IsSagaOrDefinition);

            configurator.AddSagas(sagaTypes);
        }
Beispiel #3
0
        /// <summary>
        /// Add consumers that were already added to the container to the registration
        /// </summary>
        public static void AddConsumersFromContainer(this IRegistrationConfigurator configurator, IWindsorContainer container)
        {
            var consumerTypes = container.FindTypes(TypeMetadataCache.IsConsumerOrDefinition);

            configurator.AddConsumers(consumerTypes);
        }