From af6eef2a2b52a054dc2e623f65d1413832b70bfe Mon Sep 17 00:00:00 2001 From: Frank Wagner Date: Thu, 1 Sep 2022 10:47:24 +0200 Subject: [PATCH] configure internal host (#36) * configure internal host added method to ModulesHostBuilder to configure only the internal host * added ConfigureInternalHost to interface --- .../Modules/Hosting/IModuleHostBuilder.cs | 21 +++++++++++++------ .../Modules/Hosting/ModulesHostBuilder.cs | 6 ++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/Hosuto.Abstractions/Modules/Hosting/IModuleHostBuilder.cs b/src/Hosuto.Abstractions/Modules/Hosting/IModuleHostBuilder.cs index 18ea12f..70de8ac 100644 --- a/src/Hosuto.Abstractions/Modules/Hosting/IModuleHostBuilder.cs +++ b/src/Hosuto.Abstractions/Modules/Hosting/IModuleHostBuilder.cs @@ -11,13 +11,22 @@ public interface IModulesHostBuilder: IHostBuilder IModulesHostBuilder HostModule(Action options = null) where TModule : class; IModulesHostBuilder HostModule(Type moduleType, Action options = null); + /// + /// Direct access to the host builder used to build the internal host. This could be used + /// in special cases when you would like to apply configuration only to the internal host and not to the modules. + /// + /// The delegate for configuring the that will be used + /// to construct the internal host. + /// The same instance of the for chaining. + IModulesHostBuilder ConfigureInternalHost(Action configureDelegate); + /// /// Set up the configuration for the builder itself. This will be used to initialize the /// for use later in the build process. This can be called multiple times and the results will be additive. /// /// The delegate for configuring the that will be used /// to construct the for the host. - /// The same instance of the for chaining. + /// The same instance of the for chaining. new IModulesHostBuilder ConfigureHostConfiguration(Action configureDelegate); /// @@ -27,7 +36,7 @@ public interface IModulesHostBuilder: IHostBuilder /// /// The delegate for configuring the that will be used /// to construct the for the application. - /// The same instance of the for chaining. + /// The same instance of the for chaining. new IModulesHostBuilder ConfigureAppConfiguration(Action configureDelegate); /// @@ -35,7 +44,7 @@ public interface IModulesHostBuilder: IHostBuilder /// /// The delegate for configuring the that will be used /// to construct the . - /// The same instance of the for chaining. + /// The same instance of the for chaining. new IModulesHostBuilder ConfigureServices(Action configureDelegate); @@ -44,7 +53,7 @@ public interface IModulesHostBuilder: IHostBuilder /// /// The delegate for configuring the that will be used /// to construct the internal used to configure the module builder. - /// The same instance of the for chaining. + /// The same instance of the for chaining. IModulesHostBuilder ConfigureFrameworkServices(Action configureDelegate); @@ -54,7 +63,7 @@ public interface IModulesHostBuilder: IHostBuilder /// /// The type of builder. /// The factory to register. - /// The same instance of the for chaining. + /// The same instance of the for chaining. new IModulesHostBuilder UseServiceProviderFactory(IServiceProviderFactory factory); #if NETSTANDARD2_1 @@ -71,7 +80,7 @@ public interface IModulesHostBuilder: IHostBuilder /// /// The type of builder. /// The delegate which configures the builder. - /// The same instance of the for chaining. + /// The same instance of the for chaining. new IModulesHostBuilder ConfigureContainer(Action configureDelegate); diff --git a/src/Hosuto.Hosting/Modules/Hosting/ModulesHostBuilder.cs b/src/Hosuto.Hosting/Modules/Hosting/ModulesHostBuilder.cs index c0fe1be..4901172 100644 --- a/src/Hosuto.Hosting/Modules/Hosting/ModulesHostBuilder.cs +++ b/src/Hosuto.Hosting/Modules/Hosting/ModulesHostBuilder.cs @@ -43,6 +43,12 @@ public IModulesHostBuilder ConfigureHostConfiguration( return this; } + public IModulesHostBuilder ConfigureInternalHost(Action configureDelegate) + { + configureDelegate(_innerBuilder); + return this; + } + public IModulesHostBuilder ConfigureFrameworkServices(Action configureDelegate) { _configureFrameworkActions.Add(configureDelegate ?? throw new ArgumentNullException(nameof(configureDelegate)));