Ejemplo n.º 1
0
        public void RegisterDefaultServices()
        {
            applicationContext.RegisterSingleton <IServiceLocator>(() => new SpringServiceLocator(applicationContext));
            applicationContext.RegisterSingletons <IBusConfigurationAware>(typeof(IServiceBus).Assembly);

            foreach (var busConfigurationAware in applicationContext.GetAll <IBusConfigurationAware>())
            {
                busConfigurationAware.Configure(config, this);
            }

            foreach (var module in config.MessageModules)
            {
                applicationContext.RegisterSingleton(module, module.FullName);
            }


            applicationContext.RegisterSingleton <IReflection>(() => new DefaultReflection());
            applicationContext.RegisterSingleton(config.SerializerType);
            applicationContext.RegisterSingleton <IEndpointRouter>(() => new EndpointRouter());
        }
Ejemplo n.º 2
0
        public void RegisterDefaultServices(IEnumerable <Assembly> assemblies)
        {
            applicationContext.RegisterSingleton <IServiceLocator>(() => new SpringServiceLocator(applicationContext));
            foreach (var assembly in assemblies)
            {
                applicationContext.RegisterSingletons <IBusConfigurationAware>(assembly);
            }

            var locator = applicationContext.Get <IServiceLocator>();

            foreach (var busConfigurationAware in applicationContext.GetAll <IBusConfigurationAware>())
            {
                busConfigurationAware.Configure(config, this, locator);
            }

            foreach (var module in config.MessageModules)
            {
                applicationContext.RegisterSingleton(module, module.FullName);
            }

            applicationContext.RegisterSingleton <IReflection>(() => new SpringReflection());
            applicationContext.RegisterSingleton(config.SerializerType);
            applicationContext.RegisterSingleton <IEndpointRouter>(() => new EndpointRouter());
        }