예제 #1
0
        public void Configure(IReceiveEndpointConfigurator configurator, IServiceProvider serviceProvider)
        {
            var sagaRepository = serviceProvider.GetRequiredService <ISagaRepository <T> >();

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

            configurator.Saga(repository);
        }
예제 #2
0
        public static void Saga <T>(this IReceiveEndpointConfigurator configurator, IContainer container, Action <ISagaConfigurator <T> > configure = null)
            where T : class, ISaga
        {
            var repository     = container.GetInstance <ISagaRepository <T> >();
            var sagaRepository = new ScopeSagaRepository <T>(repository, new LamarSagaScopeProvider <T>(container));

            configurator.Saga(sagaRepository, configure);
        }
예제 #3
0
        public static void Saga <T>(this IReceiveEndpointConfigurator configurator, IContext context, Action <ISagaConfigurator <T> > configure)
            where T : class, ISaga
        {
            var repository = context.GetInstance <ISagaRepository <T> >();

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

            configurator.Saga(sagaRepository, configure);
        }
        /// <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="serviceProvider"></param>
        /// <param name="configure"></param>
        /// <returns></returns>
        public static void Saga <T>(this IReceiveEndpointConfigurator configurator, IServiceProvider serviceProvider, Action <ISagaConfigurator <T> > configure = null)
            where T : class, ISaga
        {
            var sagaRepository = serviceProvider.GetRequiredService <ISagaRepository <T> >();

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

            configurator.Saga(repository, configure);
        }
예제 #5
0
        public ISagaRepository <T> CreateSagaRepository <T>() where T : class, ISaga
        {
            var repository = _container.Resolve <ISagaRepository <T> >();

            var scopeProvider = new UnitySagaScopeProvider <T>(_container);

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

            return(sagaRepository);
        }
예제 #6
0
        public ISagaRepository <T> CreateSagaRepository <T>() where T : class, ISaga
        {
            var repository = _container.GetInstance <ISagaRepository <T> >();

            var scopeProvider = new SimpleInjectorSagaScopeProvider <T>(_container);

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

            return(sagaRepository);
        }
예제 #7
0
        public static void Saga <T>(this IReceiveEndpointConfigurator configurator, IUnityContainer container, Action <ISagaConfigurator <T> > configure = null)
            where T : class, ISaga
        {
            var repository = container.Resolve <ISagaRepository <T> >();

            var scopeProvider = new UnitySagaScopeProvider <T>(container);

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

            configurator.Saga(sagaRepository, configure);
        }
예제 #8
0
        /// <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="scope"></param>
        /// <param name="configure"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static void Saga <T>(this IReceiveEndpointConfigurator configurator, ILifetimeScope scope, Action <ISagaConfigurator <T> > configure, string name = "message")
            where T : class, ISaga
        {
            var repository = scope.Resolve <ISagaRepository <T> >();

            ISagaScopeProvider <T> scopeProvider = new AutofacSagaScopeProvider <T>(new SingleLifetimeScopeProvider(scope), name);

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

            configurator.Saga(sagaRepository, configure);
        }
        /// <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);
        }
        public ISagaRepository <T> CreateSagaRepository <T>(Action <ConsumeContext> scopeAction)
            where T : class, ISaga
        {
            var repository = _container.Resolve <ISagaRepository <T> >();

            var scopeProvider = new UnitySagaScopeProvider <T>(_container);
            // if (scopeAction != null)
            //     scopeProvider.AddScopeAction(scopeAction);

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

            return(sagaRepository);
        }
예제 #11
0
        /// <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="context"></param>
        /// <param name="configure"></param>
        /// <param name="name"></param>
        /// <param name="configureScope">Configuration for scope container</param>
        /// <returns></returns>
        public static void Saga <T>(this IReceiveEndpointConfigurator configurator, IComponentContext context, Action <ISagaConfigurator <T> > configure, string name = "message",
                                    Action <ContainerBuilder, ConsumeContext> configureScope = null)
            where T : class, ISaga
        {
            var scope = context.Resolve <ILifetimeScope>();

            var repository = scope.Resolve <ISagaRepository <T> >();

            ISagaScopeProvider <T> scopeProvider = new AutofacSagaScopeProvider <T>(new SingleLifetimeScopeProvider(scope), name, configureScope);

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

            configurator.Saga(sagaRepository, configure);
        }