示例#1
0
        public IBus CreateBus(Action <IHandlerRegistry> handlerConfig, Func <RebusConfigurer, RebusConfigurer> configureBus, out IActivatedContainer container)
        {
            var services = new ServiceCollection();

            handlerConfig.Invoke(new HandlerRegistry(services));

            services.AddRebus(configureBus);

            var provider = services.BuildServiceProvider();

            container = new ActivatedContainer(provider);

            provider.UseRebus();

            return(container.ResolveBus());
        }
        public IHandlerActivator CreateActivator(Action <IHandlerRegistry> configureHandlers, out IActivatedContainer container)
        {
            var unityContainer = new UnityContainer();

            configureHandlers.Invoke(new HandlerRegistry(unityContainer));

            container = new ActivatedContainer(unityContainer);

            return(new UnityContainerAdapter(unityContainer));
        }
        public IHandlerActivator CreateActivator(Action <IHandlerRegistry> configureHandlers, out IActivatedContainer container)
        {
            var registry = new HandlerRegistry();

            configureHandlers(registry);

            var simpleInjContainer = new Container();

            registry.ApplyRegistrations(simpleInjContainer);

            container = new ActivatedContainer(simpleInjContainer);

            return(new SimpleInjectorContainerAdapter(simpleInjContainer));
        }
        public IHandlerActivator CreateActivator(Action <IHandlerRegistry> configureHandlers, out IActivatedContainer container)
        {
            var containerBuilder = new ContainerBuilder();

            configureHandlers(new HandlerRegistry(containerBuilder));

            var autoFacContainer = containerBuilder.Build();

            container = new ActivatedContainer(autoFacContainer);

            return(new AutofacContainerAdapter(autoFacContainer));
        }
        public IHandlerActivator CreateActivator(Action <IHandlerRegistry> configureHandlers, out IActivatedContainer container)
        {
            var kernel = new StandardKernel();

            configureHandlers(new HandlerRegistry(kernel));

            container = new ActivatedContainer(kernel);

            return(new NinjectContainerAdapter(kernel));
        }
示例#6
0
    public IHandlerActivator CreateActivator(Action <IHandlerRegistry> configureHandlers, out IActivatedContainer container)
    {
        var activator = new BuiltinHandlerActivator();

        configureHandlers?.Invoke(new HandlerRegistry(activator));

        container = new ActivatedContainer(activator);

        return(activator);
    }
示例#7
0
        public IBus CreateBus(Action <IHandlerRegistry> configureHandlers, Func <RebusConfigurer, RebusConfigurer> configureBus, out IActivatedContainer container)
        {
            var dryContainer = CreateDryContainer();

            configureHandlers.Invoke(new HandlerRegistry(dryContainer));

            container = new ActivatedContainer(dryContainer);

            return(configureBus(Configure.With(new DryIocContainerAdapter(dryContainer))).Start());
        }
示例#8
0
 public static IBus CreateBus(this IActivationContext context, Func <RebusConfigurer, RebusConfigurer> configureBus, out IActivatedContainer container)
 {
     return(context.CreateBus(registry => {}, configureBus, out container));
 }
        public IHandlerActivator CreateActivator(Action <IHandlerRegistry> handlerConfig, out IActivatedContainer container)
        {
            var windsorContainer = new WindsorContainer();

            handlerConfig.Invoke(new HandlerRegistry(windsorContainer));

            container = new ActivatedContainer(windsorContainer);

            return(new CastleWindsorContainerAdapter(windsorContainer));
        }
        public IBus CreateBus(Action <IHandlerRegistry> handlerConfig, Func <RebusConfigurer, RebusConfigurer> configureBus, out IActivatedContainer container)
        {
            var windsorContainer = new WindsorContainer();

            handlerConfig.Invoke(new HandlerRegistry(windsorContainer));
            container = new ActivatedContainer(windsorContainer);

            return(configureBus(Configure.With(new CastleWindsorContainerAdapter(windsorContainer))).Start());
        }
示例#11
0
        public IBus CreateBus(Action <IHandlerRegistry> configureHandlers, Func <RebusConfigurer, RebusConfigurer> configureBus, out IActivatedContainer container)
        {
            var lightInjectContainer = new ServiceContainer();

            configureHandlers(new HandlerRegistry(lightInjectContainer));

            container = new ActivatedContainer(lightInjectContainer);

            return(configureBus(Configure.With(new LightInjectContainerAdapter(lightInjectContainer))).Start());
        }
示例#12
0
        public IHandlerActivator CreateActivator(Action <IHandlerRegistry> configureHandlers, out IActivatedContainer container)
        {
            var lightInjectContainer = new ServiceContainer();

            configureHandlers(new HandlerRegistry(lightInjectContainer));

            container = new ActivatedContainer(lightInjectContainer);

            return(new LightInjectContainerAdapter(lightInjectContainer));
        }
        public IBus CreateBus(Action <IHandlerRegistry> configureHandlers, Func <RebusConfigurer, RebusConfigurer> configureBus, out IActivatedContainer container)
        {
            var _containerBuilder = new ContainerBuilder();

            configureHandlers(new HandlerRegistry(_containerBuilder));

            var autoFacContainer = _containerBuilder.Build();

            container = new ActivatedContainer(autoFacContainer);

            return(configureBus(Configure.With(new AutofacContainerAdapter(autoFacContainer))).Start());
        }
        public IHandlerActivator CreateActivator(Action <IHandlerRegistry> configureHandlers, out IActivatedContainer container)
        {
            var sm = new Container();

            configureHandlers.Invoke(new HandlerRegistry(sm));

            container = new ActivatedContainer(sm);

            return(new StructureMapContainerAdapter(sm));
        }
示例#15
0
        public IHandlerActivator CreateActivator(Action <IHandlerRegistry> configureHandlers, out IActivatedContainer container)
        {
            var registry = new HandlerRegistry();

            configureHandlers(registry);

            var simpleInjContainer = new Container
            {
                Options =
                {
                    DefaultScopedLifestyle = ScopedLifestyle.Flowing,
                    EnableAutoVerification = false //< disable verification for tests to avoid tricking instance counters in contract tests
                }
            };

            registry.ApplyRegistrations(simpleInjContainer);

            container = new ActivatedContainer(simpleInjContainer);

            return(new SimpleInjectorContainerAdapter(simpleInjContainer));
        }
        public IBus CreateBus(Action <IHandlerRegistry> configureHandlers, Func <RebusConfigurer, RebusConfigurer> configureBus, out IActivatedContainer container)
        {
            var sm = new Container();

            configureHandlers.Invoke(new HandlerRegistry(sm));
            container = new ActivatedContainer(sm);

            return(configureBus(Configure.With(new StructureMapContainerAdapter(sm))).Start());
        }
示例#17
0
        public IBus CreateBus(Action <IHandlerRegistry> configureHandlers, Func <RebusConfigurer, RebusConfigurer> configureBus, out IActivatedContainer container)
        {
            var registry = new HandlerRegistry();

            configureHandlers(registry);

            var simpleInjContainer = new Container
            {
                Options =
                {
                    DefaultScopedLifestyle = ScopedLifestyle.Flowing,
                    EnableAutoVerification = false //< disable verification for tests to avoid tricking instance counters in contract tests
                }
            };

            registry.ApplyRegistrations(simpleInjContainer);

            container = new ActivatedContainer(simpleInjContainer);

            //return configureBus(Configure.With(new SimpleInjectorContainerAdapter(simpleInjContainer))).Start();
            simpleInjContainer.ConfigureRebus(configurer => configureBus(configurer).Start());

            simpleInjContainer.StartBus();

            return(simpleInjContainer.GetInstance <IBus>());
        }
示例#18
0
 public static IHandlerActivator CreateActivator(this IActivationContext context, out IActivatedContainer container)
 {
     return(context.CreateActivator(handlers => { }, out container));
 }
示例#19
0
        public IHandlerActivator CreateActivator(Action <IHandlerRegistry> configureHandlers, out IActivatedContainer container)
        {
            var builder = new ContainerBuilder();

            configureHandlers(new HandlerRegistry(builder));

            var containerAdapter = new AutofacHandlerActivator(builder, (conf, con) => { }, startBus: false, enablePolymorphicDispatch: true);

            var autofacContainer = builder.Build();

            container = new ActivatedContainer(autofacContainer);

            return(containerAdapter);
        }
        public IBus CreateBus(Action <IHandlerRegistry> configureHandlers, Func <RebusConfigurer, RebusConfigurer> configureBus, out IActivatedContainer container)
        {
            var kernel = new StandardKernel();

            configureHandlers(new HandlerRegistry(kernel));

            container = new ActivatedContainer(kernel);

            return(configureBus(Configure.With(new NinjectContainerAdapter(kernel))).Start());
        }
示例#21
0
        public IBus CreateBus(Action <IHandlerRegistry> configureHandlers, Func <RebusConfigurer, RebusConfigurer> configureBus, out IActivatedContainer container)
        {
            var containerBuilder = new ContainerBuilder();

            configureHandlers(new HandlerRegistry(containerBuilder));

            new AutofacHandlerActivator(containerBuilder, (conf, con) => configureBus(conf), startBus: true, enablePolymorphicDispatch: true);

            var autofacContainer = containerBuilder.Build();

            container = new ActivatedContainer(autofacContainer);

            return(container.ResolveBus());
        }
示例#22
0
    public IBus CreateBus(Action <IHandlerRegistry> configureHandlers, Func <RebusConfigurer, RebusConfigurer> configureBus, out IActivatedContainer container)
    {
        var activator = new BuiltinHandlerActivator();

        configureHandlers(new HandlerRegistry(activator));

        container = new ActivatedContainer(activator);

        return(configureBus(Configure.With(activator)).Start());
    }
示例#23
0
        public IHandlerActivator CreateActivator(Action <IHandlerRegistry> handlerConfig, out IActivatedContainer container)
        {
            var services = new ServiceCollection();

            handlerConfig.Invoke(new HandlerRegistry(services));
            services.AddSingleton <IApplicationLifetime>(new TestLifetime());

            var provider = services.BuildServiceProvider();

            var adapter = new NetCoreServiceProviderContainerAdapter(provider);

            container = new ActivatedContainer(provider);

            return(adapter);
        }
        public IBus CreateBus(Action <IHandlerRegistry> configureHandlers, Func <RebusConfigurer, RebusConfigurer> configureBus, out IActivatedContainer container)
        {
            var registry = new HandlerRegistry();

            configureHandlers(registry);

            var simpleInjContainer = new Container();

            registry.ApplyRegistrations(simpleInjContainer);

            container = new ActivatedContainer(simpleInjContainer);

            //return configureBus(Configure.With(new SimpleInjectorContainerAdapter(simpleInjContainer))).Start();
            simpleInjContainer.ConfigureRebus(configurer => configureBus(configurer).Start());

            simpleInjContainer.StartBus();

            return(simpleInjContainer.GetInstance <IBus>());
        }
        public IHandlerActivator CreateActivator(Action <IHandlerRegistry> handlerConfig, out IActivatedContainer container)
        {
            var services = new ServiceCollection().AddSingleton(p => new DependencyInjectionHandlerActivator(p));

            handlerConfig.Invoke(new HandlerRegistry(services));

            var provider = services.BuildServiceProvider();

            container = new ActivatedContainer(provider);

            return(provider.GetRequiredService <DependencyInjectionHandlerActivator>());
        }