diff --git a/src/Sitko.Core.App.Web/WebApplication.cs b/src/Sitko.Core.App.Web/WebApplication.cs index 74cd06b64..ab4aa2156 100644 --- a/src/Sitko.Core.App.Web/WebApplication.cs +++ b/src/Sitko.Core.App.Web/WebApplication.cs @@ -96,18 +96,19 @@ protected override void ConfigureHostBuilder(IHostBuilder builder) }); } - protected override void PostConfigureHostBuilder(IHostBuilder hostBuilder) + protected override void PostConfigureHostBuilder(IApplicationContext applicationContext, IHostBuilder hostBuilder) { - base.PostConfigureHostBuilder(hostBuilder); + base.PostConfigureHostBuilder(applicationContext, hostBuilder); hostBuilder.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseSetting("ApplicationId", Id.ToString()); webBuilder.UseStartup(); - ConfigureWebHostDefaults(webBuilder); + ConfigureWebHostDefaults(applicationContext, webBuilder); }); } - protected virtual void ConfigureWebHostDefaults(IWebHostBuilder webHostBuilder) + protected virtual void ConfigureWebHostDefaults(IApplicationContext applicationContext, + IWebHostBuilder webHostBuilder) { } @@ -143,4 +144,3 @@ public static TWebApplication Run(this TWebApplicatio return application; } } - diff --git a/src/Sitko.Core.App/HostedApplication.cs b/src/Sitko.Core.App/HostedApplication.cs index 3a84547cd..4cc91912c 100644 --- a/src/Sitko.Core.App/HostedApplication.cs +++ b/src/Sitko.Core.App/HostedApplication.cs @@ -149,12 +149,12 @@ protected IHostBuilder ConfigureHostBuilder(Action? configure = nu }); }); configure?.Invoke(hostBuilder); - PostConfigureHostBuilder(hostBuilder); + PostConfigureHostBuilder(bootApplicationContext, hostBuilder); LogInternal("Create host builder done"); return hostBuilder; } - protected virtual void PostConfigureHostBuilder(IHostBuilder hostBuilder) + protected virtual void PostConfigureHostBuilder(IApplicationContext applicationContext, IHostBuilder hostBuilder) { } diff --git a/src/Sitko.Core.Xunit.Web/WebTestApplication.cs b/src/Sitko.Core.Xunit.Web/WebTestApplication.cs index 365c4bfa5..ee8a2dcd7 100644 --- a/src/Sitko.Core.Xunit.Web/WebTestApplication.cs +++ b/src/Sitko.Core.Xunit.Web/WebTestApplication.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.TestHost; +using Sitko.Core.App; using Sitko.Core.App.Web; namespace Sitko.Core.Xunit.Web; @@ -10,9 +11,10 @@ protected WebTestApplication(string[] args) : base(args) { } - protected override void ConfigureWebHostDefaults(IWebHostBuilder webHostBuilder) + protected override void ConfigureWebHostDefaults(IApplicationContext applicationContext, + IWebHostBuilder webHostBuilder) { - base.ConfigureWebHostDefaults(webHostBuilder); + base.ConfigureWebHostDefaults(applicationContext, webHostBuilder); webHostBuilder.UseTestServer(); } } diff --git a/tests/Sitko.Core.Grpc.Server.Tests/TestApplication.cs b/tests/Sitko.Core.Grpc.Server.Tests/TestApplication.cs index 85ac7523c..48206a2f1 100644 --- a/tests/Sitko.Core.Grpc.Server.Tests/TestApplication.cs +++ b/tests/Sitko.Core.Grpc.Server.Tests/TestApplication.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.TestHost; +using Sitko.Core.App; using Sitko.Core.App.Web; namespace Sitko.Core.Grpc.Server.Tests; @@ -12,10 +13,10 @@ public TestApplication(string[] args) : base(args) => moduleOptions.RegisterService(); }); - protected override void ConfigureWebHostDefaults(IWebHostBuilder webHostBuilder) + protected override void ConfigureWebHostDefaults(IApplicationContext applicationContext, + IWebHostBuilder webHostBuilder) { - base.ConfigureWebHostDefaults(webHostBuilder); + base.ConfigureWebHostDefaults(applicationContext, webHostBuilder); webHostBuilder.UseTestServer(); } } -