From 5b8645c9c6588e33fd5186937c36eba714599dc7 Mon Sep 17 00:00:00 2001
From: George Drak <sonicgd@gmail.com>
Date: Wed, 31 Jan 2024 16:59:28 +0500
Subject: [PATCH] feat: add ConfigureServices overload with IApplicationContext

---
 src/Sitko.Core.App/ISitkoCoreApplicationBuilder.cs    | 4 +++-
 src/Sitko.Core.App/SitkoCoreBaseApplicationBuilder.cs | 6 ++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/Sitko.Core.App/ISitkoCoreApplicationBuilder.cs b/src/Sitko.Core.App/ISitkoCoreApplicationBuilder.cs
index 4ab2c1550..891e69960 100644
--- a/src/Sitko.Core.App/ISitkoCoreApplicationBuilder.cs
+++ b/src/Sitko.Core.App/ISitkoCoreApplicationBuilder.cs
@@ -1,4 +1,5 @@
-using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
 using Serilog;
 using Serilog.Events;
 
@@ -28,4 +29,5 @@ ISitkoCoreApplicationBuilder ConfigureLogging(
         Func<IApplicationContext, LoggerConfiguration, LoggerConfiguration> configure);
 
     ISitkoCoreApplicationBuilder ConfigureServices(Action<IServiceCollection> configure);
+    ISitkoCoreApplicationBuilder ConfigureServices(Action<IApplicationContext, IServiceCollection> configure);
 }
diff --git a/src/Sitko.Core.App/SitkoCoreBaseApplicationBuilder.cs b/src/Sitko.Core.App/SitkoCoreBaseApplicationBuilder.cs
index d2178dc47..665ec205e 100644
--- a/src/Sitko.Core.App/SitkoCoreBaseApplicationBuilder.cs
+++ b/src/Sitko.Core.App/SitkoCoreBaseApplicationBuilder.cs
@@ -60,6 +60,12 @@ public ISitkoCoreApplicationBuilder ConfigureLogging(
         return this;
     }
 
+    public ISitkoCoreApplicationBuilder ConfigureServices(Action<IApplicationContext, IServiceCollection> configure)
+    {
+        configure(bootApplicationContext!, Services);
+        return this;
+    }
+
     public ISitkoCoreApplicationBuilder ConfigureServices(Action<IServiceCollection> configure)
     {
         configure(Services);