コード例 #1
0
        private void Initialize()
        {
            RecordStartup(loggingSettings);

            // .NET default limit is 10. RavenDB in conjunction with transports that use HTTP exceeds that limit.
            ServicePointManager.DefaultConnectionLimit = settings.HttpDefaultConnectionLimit;

            timeKeeper = new TimeKeeper();

            var containerBuilder = new ContainerBuilder();

            var domainEvents = new DomainEvents();

            containerBuilder.RegisterInstance(domainEvents).As <IDomainEvents>();
            containerBuilder.RegisterType <MessageStreamerConnection>().SingleInstance();
            containerBuilder.RegisterInstance(loggingSettings);
            containerBuilder.RegisterInstance(settings);
            containerBuilder.RegisterInstance(notifier).ExternallyOwned();
            containerBuilder.RegisterInstance(timeKeeper).ExternallyOwned();
            containerBuilder.RegisterType <SubscribeToOwnEvents>().PropertiesAutowired().SingleInstance();
            containerBuilder.RegisterInstance(documentStore).As <IDocumentStore>().ExternallyOwned();
            containerBuilder.Register(c => HttpClientFactory);
            containerBuilder.RegisterModule <ApisModule>();

            container = containerBuilder.Build();
            Startup   = new Startup(container);

            domainEvents.SetContainer(container);
        }
コード例 #2
0
        private void Initialize()
        {
            RecordStartup(loggingSettings, configuration);

            // .NET default limit is 10. RavenDB in conjunction with transports that use HTTP exceeds that limit.
            ServicePointManager.DefaultConnectionLimit = settings.HttpDefaultConnectionLimit;

            timeKeeper = new TimeKeeper();

            transportCustomization = settings.LoadTransportCustomization();
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource(type => type.Assembly == typeof(Bootstrapper).Assembly && type.GetInterfaces().Any() == false));

            var domainEvents = new DomainEvents();

            containerBuilder.RegisterInstance(domainEvents).As <IDomainEvents>();

            transportSettings = new TransportSettings();
            containerBuilder.RegisterInstance(transportSettings).SingleInstance();

            var rawEndpointFactory = new RawEndpointFactory(settings, transportSettings, transportCustomization);

            containerBuilder.RegisterInstance(rawEndpointFactory).AsSelf();

            containerBuilder.RegisterType <MessageStreamerConnection>().SingleInstance();
            containerBuilder.RegisterInstance(loggingSettings);
            containerBuilder.RegisterInstance(settings);
            containerBuilder.RegisterInstance(notifier).ExternallyOwned();
            containerBuilder.RegisterInstance(timeKeeper).ExternallyOwned();
            containerBuilder.RegisterInstance(documentStore).As <IDocumentStore>().ExternallyOwned();
            containerBuilder.Register(c => HttpClientFactory);
            containerBuilder.RegisterModule <ApisModule>();
            containerBuilder.RegisterType <MessageForwarder>().AsImplementedInterfaces().SingleInstance();
            containerBuilder.Register(c => bus.Bus);

            containerBuilder.RegisterType <DomainEventBusPublisher>().AsImplementedInterfaces().AsSelf().SingleInstance();
            containerBuilder.RegisterType <EndpointInstanceMonitoring>().SingleInstance();
            containerBuilder.RegisterType <MonitoringDataPersister>().SingleInstance();

            containerBuilder.RegisterType <ServiceBus.Management.Infrastructure.Nancy.JsonNetSerializer>().As <ISerializer>();
            containerBuilder.RegisterType <ServiceBus.Management.Infrastructure.Nancy.JsonNetBodyDeserializer>().As <IBodyDeserializer>();
            containerBuilder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly()).Where(t => t.IsAssignableTo <INancyModule>()).As <INancyModule>();

            additionalRegistrationActions?.Invoke(containerBuilder);

            container = containerBuilder.Build();
            Startup   = new Startup(container);

            domainEvents.SetContainer(container);
        }
コード例 #3
0
        private void Initialize()
        {
            RecordStartup(loggingSettings, configuration);

            // .NET default limit is 10. RavenDB in conjunction with transports that use HTTP exceeds that limit.
            ServicePointManager.DefaultConnectionLimit = settings.HttpDefaultConnectionLimit;

            transportCustomization = settings.LoadTransportCustomization();
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource(type => type.Assembly == typeof(Bootstrapper).Assembly && type.GetInterfaces().Any() == false));

            var domainEvents = new DomainEvents();

            containerBuilder.RegisterInstance(domainEvents).As <IDomainEvents>();

            transportSettings = new TransportSettings
            {
                RunCustomChecks = true
            };
            containerBuilder.RegisterInstance(transportSettings).SingleInstance();

            var rawEndpointFactory = new RawEndpointFactory(settings, transportSettings, transportCustomization);

            containerBuilder.RegisterInstance(rawEndpointFactory).AsSelf();

            containerBuilder.RegisterType <MessageStreamerConnection>().SingleInstance();
            containerBuilder.RegisterInstance(loggingSettings);
            containerBuilder.RegisterInstance(settings);
            containerBuilder.RegisterInstance(notifier).ExternallyOwned();
            containerBuilder.RegisterInstance(documentStore).As <IDocumentStore>().ExternallyOwned();
            containerBuilder.Register(c => HttpClientFactory);
            containerBuilder.RegisterModule <ApisModule>();
            containerBuilder.Register(c => bus.Bus);

            containerBuilder.RegisterType <EndpointInstanceMonitoring>().SingleInstance();
            containerBuilder.RegisterType <MonitoringDataPersister>().AsImplementedInterfaces().AsSelf().SingleInstance();

            RegisterInternalWebApiControllers(containerBuilder);

            additionalRegistrationActions?.Invoke(containerBuilder);

            container = containerBuilder.Build();
            Startup   = new Startup(container);

            domainEvents.SetContainer(container);
        }