Exemplo n.º 1
0
        static void Main()
        {
            var container = new Castle.Windsor.WindsorContainer();

            container.AddFacility <TypedFactoryFacility>();

            container.Install(new LogInstaller());

            container.Register(
                Component.For <IIntegrationEventHandlerFactory>().AsFactory(new IntegrationEventHandlerComponentSelector()),

                Component.For <IEventBusSubscriptionsManager>()
                .ImplementedBy <InMemoryEventBusSubscriptionsManager>(),

                Component.For <IRabbitMQPersistentConnection>()
                .ImplementedBy <DefaultRabbitMQPersistentConnection>(),


                Component.For <IEventBus>()
                .ImplementedBy <EventBusRabbitMQ>());

            var x = container.Resolve <IEventBus>();

            while (Console.ReadLine() != "exit")
            {
                for (int i = 0; i < 10; i++)
                {
                    x.Publish(new TestIntegrationEvent());
                }
            }

            container.Dispose();
        }
    private static Castle.MicroKernel.IKernel CreateKernel()
    {
        var container = new Castle.Windsor.WindsorContainer();

        container.Install(new WindsorInstaller());
        return(container.Kernel);
    }
		protected void Application_Start()
		{
			var container = new Castle.Windsor.WindsorContainer();
			container.Install(FromAssembly.InThisApplication());

			var controllerFactory = new WindsorControllerFactory(container.Kernel);
			ControllerBuilder.Current.SetControllerFactory(controllerFactory);

			AreaRegistration.RegisterAllAreas();

			FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
			RouteConfig.RegisterRoutes(RouteTable.Routes);
			BundleConfig.RegisterBundles(BundleTable.Bundles);
		}
        public static IDependencyResolver CreateResolver()
        {
            var config = new Glass.Mapper.Sc.Config();

            //var dependencyResolver = new DependencyResolver(config);

            var container = new Castle.Windsor.WindsorContainer();

            container.Register(Component.For <AbstractDataMapper>().ImplementedBy <ImageOverlayMapper>().LifeStyle.Transient);
            container.Install(new Glass.Mapper.Sc.CastleWindsor.WindsorSitecoreInstaller(config));

            var dependencyResolver = new Glass.Mapper.Sc.CastleWindsor.DependencyResolver(container);

            return(dependencyResolver);
        }