Beispiel #1
0
        public VerboseHostBuilder(ISImplHostBuilder hostBuilder, ILogger logger)
        {
            _hostBuilder = hostBuilder;
            _logger      = logger;

            _logger.LogInformation("Verbosity is ON");
        }
Beispiel #2
0
 public void ConfigureServices(ISImplHostBuilder hostBuilder)
 {
     hostBuilder.ConfigureServices((hostBuilderContext, services) =>
     {
         BootSequence.ForEach <IServicesCollectionConfigureModule>(module => module.ConfigureServices(services));
     });
 }
Beispiel #3
0
        public static ISImplHostBuilder UseCqrsInMemoryEventDispatcher(this ISImplHostBuilder host)
        {
            var module = host.AttachNewOrGetConfiguredModule(() => new EventModule(new EventModuleConfig()));

            module.Config.EnableInMemoryEventDispatcher = true;
            return(host);
        }
Beispiel #4
0
 public RuntimeServices(INanoContainer container, ISImplHostBuilder hostBuilder, IModuleManager moduleManager, IDiagnosticsCollector diagnostics, RuntimeFlags runtimeFlags)
 {
     BootContainer = container;
     HostBuilder   = hostBuilder;
     ModuleManager = moduleManager;
     Diagnostics   = diagnostics;
     Flags         = runtimeFlags;
 }
Beispiel #5
0
        public static ISImplHostBuilder UseTransactionalRequests(this ISImplHostBuilder host, Action <HttpStorageModuleConfig> configureDelegate = null)
        {
            var module = host.AttachNewOrGetConfiguredModule(() => new HttpStorageModule(new HttpStorageModuleConfig()));

            configureDelegate?.Invoke(module.Config);

            return(host);
        }
Beispiel #6
0
        public static ISImplHostBuilder UseRedis(this ISImplHostBuilder host, Action <RedisConfig> configureDelegate)
        {
            var module = host.AttachNewOrGetConfiguredModule(() => new RedisModule(new RedisConfig()));

            configureDelegate?.Invoke(module.Config);

            return(host);
        }
Beispiel #7
0
        public static ISImplHostBuilder UseCqrsMessagingCommandDispatcher(this ISImplHostBuilder host, Action <MessagingCqrsModuleConfig> configureDelegate)
        {
            var module = host.AttachNewOrGetConfiguredModule(() => new MessagingCqrsModule(new MessagingCqrsModuleConfig()));

            configureDelegate?.Invoke(module.Config);

            return(host);
        }
Beispiel #8
0
        public static ISImplHostBuilder UseCqrsEvents(this ISImplHostBuilder host, Action <EventModuleConfig> configureDelegate = null)
        {
            var module = host.AttachNewOrGetConfiguredModule(() => new EventModule(new EventModuleConfig()));

            configureDelegate?.Invoke(module.Config);

            return(host);
        }
        private static ExamineConfig AttachModule(ISImplHostBuilder simplHostBuilder)
        {
            var config = new ExamineConfig();
            var module = new ExamineModule(config);

            simplHostBuilder.AttachNewOrGetConfiguredModule <ExamineModule>(() => module);

            return(config);
        }
Beispiel #10
0
        private static HttpOAuthConfig Attach(ISImplHostBuilder simplHostBuilder)
        {
            var config      = new HttpOAuthConfig(simplHostBuilder);
            var oauthModule = new HttpOAuthModule(config);

            simplHostBuilder.AttachNewOrGetConfiguredModule(() => oauthModule);

            return(config);
        }
        public static void UseExamine(this ISImplHostBuilder simplHostBuilder, Action <ExamineConfig> configurer)
        {
            var existingExamineModule = simplHostBuilder.GetConfiguredModule <ExamineModule>();
            var examineConfig         = existingExamineModule != null
                ? existingExamineModule.Config
                : AttachModule(simplHostBuilder);

            configurer?.Invoke(examineConfig);
        }
Beispiel #12
0
        public static ISImplHostBuilder UseNPocoRepositoryStorage(this ISImplHostBuilder host, Action <NPocoRepositoryConfig> dapperRepoConfig = null)
        {
            var config = new NPocoRepositoryConfig();

            dapperRepoConfig?.Invoke(config);

            host.AttachNewOrGetConfiguredModule(() => new NPocoRepositoryModule(config));
            return(host);
        }
Beispiel #13
0
        public static ISImplHostBuilder UseDependencyInjection(this ISImplHostBuilder host, Action <DependencyInjectionConfig> queueConfig)
        {
            var config = new DependencyInjectionConfig();

            queueConfig.Invoke(config);

            var module = host.AttachNewOrGetConfiguredModule(() => new DependencyInjectionModule(config));

            return(host);
        }
Beispiel #14
0
        public void ConfigureHostBuilder(ISImplHostBuilder hostBuilder)
        {
            BootSequence.ForEach <IHostBuilderConfigureModule>(module =>
            {
                module.ConfigureHostBuilder(hostBuilder);
            });

            // we need re-calc
            _bootSequence1 = _bootSequenceFactory.New();
        }
Beispiel #15
0
        public static void UseWebOAuth(this ISImplHostBuilder webAppBuilder, Action <HttpOAuthConfig> configure = null)
        {
            var existingModule = webAppBuilder.GetConfiguredModule <HttpOAuthModule>();

            var config = existingModule != null
                ? existingModule.Config
                : Attach(webAppBuilder);

            // Apply user configuration to module
            configure?.Invoke(config);
        }
Beispiel #16
0
        public DiagnosticsHostBuilder(ISImplHostBuilder hostBuilder, IModuleManager moduleManager, IBootSequenceFactory bootSequenceFactory, IDiagnosticsCollector diagnostics, RuntimeFlags runtimeFlags, ILogger <DiagnosticsHost> logger)
        {
            _hostBuilder         = hostBuilder;
            _moduleManager       = moduleManager;
            _bootSequenceFactory = bootSequenceFactory;
            _diagnostics         = diagnostics;
            _runtimeFlags        = runtimeFlags;
            _logger = logger;

            _diagnostics.RegisterLapTime("HostBuilder created");
        }
Beispiel #17
0
        public static ISImplHostBuilder UseInMemoryQueues(this ISImplHostBuilder host, Action <QueueModuleConfig> queueConfig)
        {
            var config = new QueueModuleConfig();

            queueConfig.Invoke(config);

            var module = host.AttachNewOrGetConfiguredModule(() => new QueueModule(config));

            module.Config.EnableInMemoryQueueManager = true;

            return(host);
        }
        public static void ConfigureWebHostStackApp(this ISImplHostBuilder hostBuilder, Action <IWebHostBuilder> configureDelegate)
        {
            // Configure Generic host
            var startupConfiguration   = new WebHostStartupConfiguration();
            var applicationHostBuilder = new WebHostBuilder(startupConfiguration);

            configureDelegate?.Invoke(applicationHostBuilder);

            // Get startup and application builder
            var startup = startupConfiguration.GetConfiguredStartup();
            var stackApplicationBuilder = RuntimeServices.Current.BootContainer.New <WebHostApplicationBuilder>();

            // attach application
            hostBuilder.AttachNewOrGetConfiguredModule(() => new WebHostStackApplicationModule(stackApplicationBuilder, startup.ConfigureStackApplication, startup.ConfigureServices));
        }
Beispiel #19
0
        public void Configure(ISImplHostBuilder hostBuilder, Action <ISImplHostBuilder> configureDelegate)
        {
            // Configure the stack host (aka attach all stack host modules)
            configureDelegate?.Invoke(hostBuilder);

            // Initialize all stack host modules
            // If host app is configures, PreInit will attach application modules
            _bootManager.PreInit();

            // Modules configure the host builder
            _bootManager.ConfigureHostBuilder(hostBuilder);

            // All modules (host and application) has been attached
            // Modules register services
            _bootManager.ConfigureServices(hostBuilder);
        }
        public static ISImplHostBuilder ConfigureWebHostStackApp(this ISImplHostBuilder hostBuilder, Action <IWebHostBuilder> configureDelegate = null)
        {
            // Configure Generic host
            var startupConfiguration   = new WebHostStartupConfiguration();
            var applicationHostBuilder = RuntimeServices.Current.BootContainer.New <WebHostBuilder>(new Dictionary <Type, object>
            {
                [typeof(WebHostStartupConfiguration)] = startupConfiguration
            });

            configureDelegate?.Invoke(applicationHostBuilder);

            // Get startup and application builder
            var startup = startupConfiguration.GetConfiguredStartup();
            var stackApplicationBuilder = RuntimeServices.Current.BootContainer.New <WebHostApplicationBuilder>();

            // attach application
            hostBuilder.AttachNewOrGetConfiguredModule(() => new WebHostStackApplicationModule(stackApplicationBuilder, startup.ConfigureStackApplication, startup.ConfigureServices));

            return(hostBuilder);
        }
Beispiel #21
0
 public void Configure(ISImplHostBuilder hostBuilder, Action <ISImplHostBuilder> configureDelegate)
 {
     _hostBuilder.Configure(hostBuilder, configureDelegate);
 }
Beispiel #22
0
 public HttpOAuthConfig(ISImplHostBuilder appBuilder)
 {
     ServerConfig = new OAuthServerConfig();
 }
Beispiel #23
0
 public void ConfigureHostBuilder(ISImplHostBuilder hostBuilder)
 {
     hostBuilder.UseCache();
 }
Beispiel #24
0
 public static ISImplHostBuilder UseCqrsMessagingCommandDispatcher(this ISImplHostBuilder host)
 {
     host.AttachNewOrGetConfiguredModule(() => new MessagingCqrsModule());
     return(host);
 }
Beispiel #25
0
 public void Configure(ISImplHostBuilder hostBuilder, Action <ISImplHostBuilder> configureDelegate)
 {
     _logger.LogDebug("HostBuilder > Configure > started");
     _hostBuilder.Configure(hostBuilder, configureDelegate);
     _logger.LogDebug("HostBuilder > Configure > ended");
 }
Beispiel #26
0
        public static ISImplHostBuilder UseInMemoryRepositoryStorage(this ISImplHostBuilder host)
        {
            host.AttachNewOrGetConfiguredModule(() => new RepositoryModule());

            return(host);
        }
 public void ConfigureHostBuilder(ISImplHostBuilder hostBuilder)
 {
     _logger.LogDebug("HostBootManager > ConfigureHostBuilder > started");
     _bootManager.ConfigureHostBuilder(hostBuilder);
     _logger.LogDebug("HostBootManager > ConfigureHostBuilder > ended");
 }
 public static void UseDotNetStackTestModule(this ISImplHostBuilder stackHostBuilders)
 {
     stackHostBuilders.Use <DotNetStackTestModule>();
 }
Beispiel #29
0
        public static ISImplHostBuilder UseInMemoryKeyValueStorage(this ISImplHostBuilder host)
        {
            host.AttachNewOrGetConfiguredModule(() => new KeyValueModule());

            return(host);
        }
Beispiel #30
0
 public AutoRunModule(ISImplHostBuilder host, AutoRunModuleConfig config)
 {
     _host  = host;
     Config = config;
 }