/// <summary>
        /// Registers a saga using the container that has the repository resolved from the container
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="configurator"></param>
        /// <param name="kernel"></param>
        /// <param name="configure"></param>
        /// <returns></returns>
        public static void Saga <T>(this IReceiveEndpointConfigurator configurator, IKernel kernel, Action <ISagaConfigurator <T> > configure = null)
            where T : class, ISaga
        {
            var repository = kernel.Resolve <ISagaRepository <T> >();

            ISagaScopeProvider <T> scopeProvider = new WindsorSagaScopeProvider <T>(kernel);

            var sagaRepository = new ScopeSagaRepository <T>(repository, scopeProvider);

            configurator.Saga(sagaRepository, configure);
        }
Ejemplo n.º 2
0
        public ISagaRepository <T> CreateSagaRepository <T>(Action <ConsumeContext> scopeAction)
            where T : class, ISaga
        {
            var repository = _kernel.Resolve <ISagaRepository <T> >();

            var scopeProvider = new WindsorSagaScopeProvider <T>(_kernel);

            if (scopeAction != null)
            {
                scopeProvider.AddScopeAction(scopeAction);
            }

            return(new ScopeSagaRepository <T>(repository, scopeProvider));
        }