Esempio n. 1
0
        /// <summary>
        /// Load the saga of the generic type from the windsor container,
        /// by loading it directly from the container.
        /// </summary>
        /// <typeparam name="T">The type of the saga</typeparam>
        /// <param name="configurator">The configurator</param>
        /// <param name="container">The windsor container</param>
        /// <param name="configure"></param>
        /// <returns>The configurator</returns>
        public static void Saga <T>(this IReceiveEndpointConfigurator configurator, IKernel container, Action <ISagaConfigurator <T> > configure = null)
            where T : class, ISaga
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }

            var sagaRepository = container.Resolve <ISagaRepository <T> >();

            var windsorSagaRepository = new WindsorSagaRepository <T>(sagaRepository, container);

            configurator.Saga(windsorSagaRepository, configure);
        }
Esempio n. 2
0
        /// <summary>
        /// Load the saga of the generic type from the windsor container,
        /// by loading it directly from the container.
        /// </summary>
        /// <typeparam name="TSaga">The type of the saga</typeparam>
        /// <param name="configurator">The configurator</param>
        /// <param name="container">The windsor container</param>
        /// <returns>The configurator</returns>
        public static SagaSubscriptionConfigurator <TSaga> Saga <TSaga>(
            [NotNull] this SubscriptionBusServiceConfigurator configurator,
            [NotNull] IWindsorContainer container)
            where TSaga : class, ISaga
        {
            if (configurator == null)
            {
                throw new ArgumentNullException("configurator");
            }
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            var sagaRepository = container.Resolve <ISagaRepository <TSaga> >();

            var windsorSagaRepository = new WindsorSagaRepository <TSaga>(sagaRepository, container);

            return(configurator.Saga(windsorSagaRepository));
        }