コード例 #1
0
        public void Run(string username)
        {
            var configuration = new BusConfiguration();

            configuration.AssembliesToScan(AllAssemblies.Except("ServiceControl.Plugin"));
            configuration.EnableInstallers(username);

            if (settings.SkipQueueCreation)
            {
                log.Info("Skipping queue creation");
                configuration.DoNotCreateQueues();
            }

            var containerBuilder = new ContainerBuilder();

            var domainEvents = new DomainEvents();

            containerBuilder.RegisterInstance(domainEvents).As <IDomainEvents>();
            var loggingSettings = new LoggingSettings(settings.ServiceName);

            containerBuilder.RegisterInstance(loggingSettings);
            var documentStore = new EmbeddableDocumentStore();

            containerBuilder.RegisterInstance(documentStore).As <IDocumentStore>().ExternallyOwned();
            containerBuilder.RegisterInstance(settings);

            using (documentStore)
                using (var container = containerBuilder.Build())
                    using (NServiceBusFactory.Create(settings, container, null, documentStore, configuration, false))
                    {
                    }
        }
コード例 #2
0
        public void Run(string username)
        {
            var configuration = new BusConfiguration();

            configuration.AssembliesToScan(AllAssemblies.Except("ServiceControl.Plugin"));
            configuration.EnableInstallers(username);

            var containerBuilder = new ContainerBuilder();
            var loggingSettings  = new LoggingSettings(settings.ServiceName);

            containerBuilder.RegisterInstance(loggingSettings);
            var documentStore = new EmbeddableDocumentStore();

            containerBuilder.RegisterInstance(documentStore).As <IDocumentStore>().ExternallyOwned();
            containerBuilder.RegisterInstance(settings);

            containerBuilder.RegisterModule <MigrationsModule>();

            using (documentStore)
                using (var container = containerBuilder.Build())
                    using (NServiceBusFactory.Create(settings, container, null, documentStore, configuration))
                    {
                        container.Resolve <MigrationsManager>().ApplyMigrations();
                    }
        }
コード例 #3
0
        public async Task Run(string username)
        {
            var configuration   = new EndpointConfiguration(settings.ServiceName);
            var assemblyScanner = configuration.AssemblyScanner();

            assemblyScanner.ExcludeAssemblies("ServiceControl.Plugin");
            if (excludeAssemblies != null)
            {
                assemblyScanner.ExcludeAssemblies(excludeAssemblies);
            }

            configuration.EnableInstallers(username);

            if (settings.SkipQueueCreation)
            {
                log.Info("Skipping queue creation");
                configuration.DoNotCreateQueues();
            }

            var containerBuilder = new ContainerBuilder();

            var domainEvents = new DomainEvents();

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

            var transportSettings = MapSettings(settings);

            containerBuilder.RegisterInstance(transportSettings).SingleInstance();

            var loggingSettings = new LoggingSettings(settings.ServiceName);

            containerBuilder.RegisterInstance(loggingSettings).SingleInstance();
            var documentStore = new EmbeddableDocumentStore();

            containerBuilder.RegisterInstance(documentStore).As <IDocumentStore>().ExternallyOwned();
            containerBuilder.RegisterInstance(settings).SingleInstance();

            using (documentStore)
                using (var container = containerBuilder.Build())
                {
                    await NServiceBusFactory.Create(settings, settings.LoadTransportCustomization(), transportSettings, loggingSettings, container, documentStore, configuration, false)
                    .ConfigureAwait(false);
                }
        }