From fea08c78bb6c832b27c4cd33e965e085d885fe56 Mon Sep 17 00:00:00 2001
From: Reuben Bond <reuben.bond@gmail.com>
Date: Thu, 4 May 2023 09:41:56 -0700
Subject: [PATCH] Finish removing Autofac

---
 .../EventBusRabbitMQ/EventBusRabbitMQ.cs      |  1 -
 .../EventBusRabbitMQ/EventBusRabbitMQ.csproj  |  1 -
 .../EventBus/EventBusRabbitMQ/GlobalUsings.cs |  1 -
 .../EventBusServiceBus.csproj                 |  1 -
 .../EventBusServiceBus/GlobalUsings.cs        |  1 -
 src/Directory.Packages.props                  |  2 --
 .../Basket/Basket.API/GlobalUsings.cs         |  1 -
 .../Identity/Identity.API/Identity.API.csproj |  1 -
 .../Ordering/Ordering.API/GlobalUsings.cs     |  2 --
 .../AutofacModules/ApplicationModule.cs       | 20 -------------------
 .../AutofacModules/MediatorModule.cs          |  9 ---------
 .../Ordering/Ordering.API/Ordering.API.csproj |  5 ++---
 src/Services/Ordering/Ordering.API/Program.cs |  5 -----
 .../Ordering.BackgroundTasks.csproj           |  2 --
 .../AutofacModules/ApplicationModule.cs       | 20 -------------------
 .../Ordering.SignalrHub/GlobalUsings.cs       |  5 +----
 .../Ordering.SignalrHub.csproj                |  1 -
 .../Ordering/Ordering.SignalrHub/Program.cs   | 11 +++++++---
 .../IdentifiedCommandHandlerTest.cs           |  3 +--
 .../Payment/Payment.API/GlobalUsings.cs       |  4 +---
 .../Payment/Payment.API/Payment.API.csproj    |  1 -
 .../Services.Common/Services.Common.csproj    |  1 -
 .../Webhooks/Webhooks.API/GlobalUsings.cs     |  4 +---
 src/Services/Webhooks/Webhooks.API/Startup.cs |  7 ++-----
 .../Webhooks/Webhooks.API/Webhooks.API.csproj |  1 -
 25 files changed, 16 insertions(+), 94 deletions(-)
 delete mode 100644 src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs
 delete mode 100644 src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/MediatorModule.cs
 delete mode 100644 src/Services/Ordering/Ordering.SignalrHub/AutofacModules/ApplicationModule.cs

diff --git a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs
index b8312d7c1..8826b88e6 100644
--- a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs
+++ b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs
@@ -4,7 +4,6 @@ using Microsoft.Extensions.DependencyInjection;
 public class EventBusRabbitMQ : IEventBus, IDisposable
 {
     const string BROKER_NAME = "eshop_event_bus";
-    const string AUTOFAC_SCOPE_NAME = "eshop_event_bus";
 
     private readonly IRabbitMQPersistentConnection _persistentConnection;
     private readonly ILogger<EventBusRabbitMQ> _logger;
diff --git a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj
index bf442f8b1..329cc99e1 100644
--- a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj
+++ b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj
@@ -6,7 +6,6 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Autofac" />
     <PackageReference Include="Microsoft.CSharp" />
     <PackageReference Include="Microsoft.Extensions.Logging" />    
     <PackageReference Include="Polly" />
diff --git a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/GlobalUsings.cs b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/GlobalUsings.cs
index 6fa5f0bf4..d63437f0e 100644
--- a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/GlobalUsings.cs
+++ b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/GlobalUsings.cs
@@ -7,7 +7,6 @@ global using RabbitMQ.Client.Exceptions;
 global using System;
 global using System.IO;
 global using System.Net.Sockets;
-global using Autofac;
 global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
 global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
 global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj
index 545f190ed..8b1785e6f 100644
--- a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj
+++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj
@@ -6,7 +6,6 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Autofac" />
     <PackageReference Include="Azure.Messaging.ServiceBus" />
     <PackageReference Include="Microsoft.CSharp" />
     <PackageReference Include="Microsoft.Extensions.Logging" />
diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/GlobalUsings.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/GlobalUsings.cs
index 73eb45c1f..836f5ae52 100644
--- a/src/BuildingBlocks/EventBus/EventBusServiceBus/GlobalUsings.cs
+++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/GlobalUsings.cs
@@ -2,7 +2,6 @@
 global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
 global using System.Threading.Tasks;
 global using System;
-global using Autofac;
 global using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
 global using Microsoft.Extensions.Logging;
 global using System.Text;
diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index 4f8a92814..4437cc543 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -14,8 +14,6 @@
     <PackageVersion Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.5" />
     <PackageVersion Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="6.0.5" />
     <PackageVersion Include="AspNetCore.HealthChecks.Uris" Version="6.0.3" />
-    <PackageVersion Include="Autofac" Version="6.5.0" />
-    <PackageVersion Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
     <PackageVersion Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.2" />
     <PackageVersion Include="Azure.Identity" Version="1.8.2" />
     <PackageVersion Include="Azure.Messaging.ServiceBus" Version="7.12.0" />
diff --git a/src/Services/Basket/Basket.API/GlobalUsings.cs b/src/Services/Basket/Basket.API/GlobalUsings.cs
index 768af4a41..c0c12186a 100644
--- a/src/Services/Basket/Basket.API/GlobalUsings.cs
+++ b/src/Services/Basket/Basket.API/GlobalUsings.cs
@@ -6,7 +6,6 @@ global using System.Net;
 global using System.Security.Claims;
 global using System.Text.Json;
 global using System.Threading.Tasks;
-global using Autofac;
 global using Basket.API.Infrastructure.ActionResults;
 global using Basket.API.Infrastructure.Exceptions;
 global using Basket.API.Infrastructure.Filters;
diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj
index 93bf5b3a5..4afd80c1c 100644
--- a/src/Services/Identity/Identity.API/Identity.API.csproj
+++ b/src/Services/Identity/Identity.API/Identity.API.csproj
@@ -11,7 +11,6 @@
   <ItemGroup>
     <PackageReference Include="AspNetCore.HealthChecks.SqlServer" />
     <PackageReference Include="AspNetCore.HealthChecks.UI.Client" />
-    <PackageReference Include="Autofac.Extensions.DependencyInjection" />
     <PackageReference Include="Duende.IdentityServer.AspNetIdentity" />
     <PackageReference Include="Duende.IdentityServer.EntityFramework.Storage" />
     <PackageReference Include="Duende.IdentityServer.EntityFramework" />
diff --git a/src/Services/Ordering/Ordering.API/GlobalUsings.cs b/src/Services/Ordering/Ordering.API/GlobalUsings.cs
index 1ae71968a..e52b97941 100644
--- a/src/Services/Ordering/Ordering.API/GlobalUsings.cs
+++ b/src/Services/Ordering/Ordering.API/GlobalUsings.cs
@@ -1,7 +1,5 @@
 global using ApiModels = Microsoft.eShopOnContainers.Services.Ordering.API.Application.Models;
 global using AppCommand = Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands;
-global using Autofac.Extensions.DependencyInjection;
-global using Autofac;
 global using Azure.Core;
 global using Azure.Identity;
 global using Dapper;
diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs b/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs
deleted file mode 100644
index 451b2b7d8..000000000
--- a/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules;
-
-public class ApplicationModule
-    : Autofac.Module
-{
-
-    public string QueriesConnectionString { get; }
-
-    public ApplicationModule(string qconstr)
-    {
-        QueriesConnectionString = qconstr;
-
-    }
-
-    protected override void Load(ContainerBuilder builder)
-    {
-
-
-    }
-}
diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/MediatorModule.cs b/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/MediatorModule.cs
deleted file mode 100644
index c343d8290..000000000
--- a/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/MediatorModule.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules;
-
-public class MediatorModule : Autofac.Module
-{
-    protected override void Load(ContainerBuilder builder)
-    {
-
-    }
-}
diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj
index da1157d59..a3abadcab 100644
--- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj
+++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj
@@ -20,7 +20,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <InternalsVisibleTo Include="Ordering.FunctionalTests"/>
+    <InternalsVisibleTo Include="Ordering.FunctionalTests" />
   </ItemGroup>
 
   <ItemGroup>
@@ -44,7 +44,6 @@
     <PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" />
     <PackageReference Include="AspNetCore.HealthChecks.SqlServer" />
     <PackageReference Include="AspNetCore.HealthChecks.UI.Client" />
-    <PackageReference Include="Autofac.Extensions.DependencyInjection" />
     <PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" />
     <PackageReference Include="Azure.Identity" />
     <PackageReference Include="Dapper" />
@@ -74,4 +73,4 @@
     </None>
   </ItemGroup>
 
-</Project>
+</Project>
\ No newline at end of file
diff --git a/src/Services/Ordering/Ordering.API/Program.cs b/src/Services/Ordering/Ordering.API/Program.cs
index c6b30c355..26ab83a3a 100644
--- a/src/Services/Ordering/Ordering.API/Program.cs
+++ b/src/Services/Ordering/Ordering.API/Program.cs
@@ -38,11 +38,6 @@ builder.Services
     .AddCustomConfiguration(builder.Configuration)
     .AddEventBus(builder.Configuration);
 
-builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
-// Register your own things directly with Autofac here. Don't
-// call builder.Populate(), that happens in AutofacServiceProviderFactory
-// for you.
-
 var services = builder.Services;
 
         services.AddMediatR(cfg =>
diff --git a/src/Services/Ordering/Ordering.BackgroundTasks/Ordering.BackgroundTasks.csproj b/src/Services/Ordering/Ordering.BackgroundTasks/Ordering.BackgroundTasks.csproj
index 1ac347d86..0b9cabbcc 100644
--- a/src/Services/Ordering/Ordering.BackgroundTasks/Ordering.BackgroundTasks.csproj
+++ b/src/Services/Ordering/Ordering.BackgroundTasks/Ordering.BackgroundTasks.csproj
@@ -12,8 +12,6 @@
     <PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" />
     <PackageReference Include="AspNetCore.HealthChecks.SqlServer" />
     <PackageReference Include="AspNetCore.HealthChecks.UI.Client" />
-    <PackageReference Include="Autofac.Extensions.DependencyInjection" />
-    <PackageReference Include="Autofac" />
     <PackageReference Include="Dapper" />
     <PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" />
     <PackageReference Include="Microsoft.Extensions.Hosting" />
diff --git a/src/Services/Ordering/Ordering.SignalrHub/AutofacModules/ApplicationModule.cs b/src/Services/Ordering/Ordering.SignalrHub/AutofacModules/ApplicationModule.cs
deleted file mode 100644
index 9d28154ea..000000000
--- a/src/Services/Ordering/Ordering.SignalrHub/AutofacModules/ApplicationModule.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.AutofacModules;
-
-public class ApplicationModule
-    : Autofac.Module
-{
-
-    public string QueriesConnectionString { get; }
-
-    public ApplicationModule()
-    {
-    }
-
-    protected override void Load(ContainerBuilder builder)
-    {
-
-        builder.RegisterAssemblyTypes(typeof(OrderStatusChangedToAwaitingValidationIntegrationEvent).GetTypeInfo().Assembly)
-            .AsClosedTypesOf(typeof(IIntegrationEventHandler<>));
-
-    }
-}
diff --git a/src/Services/Ordering/Ordering.SignalrHub/GlobalUsings.cs b/src/Services/Ordering/Ordering.SignalrHub/GlobalUsings.cs
index a6c14a022..5d956ba77 100644
--- a/src/Services/Ordering/Ordering.SignalrHub/GlobalUsings.cs
+++ b/src/Services/Ordering/Ordering.SignalrHub/GlobalUsings.cs
@@ -1,6 +1,4 @@
-global using Autofac.Extensions.DependencyInjection;
-global using Autofac;
-global using HealthChecks.UI.Client;
+global using HealthChecks.UI.Client;
 global using Microsoft.AspNetCore.Authentication.JwtBearer;
 global using Microsoft.AspNetCore.Authorization;
 global using Microsoft.AspNetCore.Builder;
@@ -19,7 +17,6 @@ global using Microsoft.Extensions.Configuration;
 global using Microsoft.Extensions.DependencyInjection;
 global using Microsoft.Extensions.Diagnostics.HealthChecks;
 global using Microsoft.Extensions.Logging;
-global using Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.AutofacModules;
 global using Microsoft.eShopOnContainers.Services.Ordering.SignalrHub.IntegrationEvents.EventHandling;
 global using Microsoft.eShopOnContainers.Services.Ordering.SignalrHub;
 global using RabbitMQ.Client;
diff --git a/src/Services/Ordering/Ordering.SignalrHub/Ordering.SignalrHub.csproj b/src/Services/Ordering/Ordering.SignalrHub/Ordering.SignalrHub.csproj
index 787776c41..0eab4e6cb 100644
--- a/src/Services/Ordering/Ordering.SignalrHub/Ordering.SignalrHub.csproj
+++ b/src/Services/Ordering/Ordering.SignalrHub/Ordering.SignalrHub.csproj
@@ -11,7 +11,6 @@
 	  <PackageReference Include="AspNetCore.HealthChecks.AzureServiceBus" />
 	  <PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" />
 	  <PackageReference Include="AspNetCore.HealthChecks.UI.Client" />
-	  <PackageReference Include="Autofac.Extensions.DependencyInjection" />
 	  <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" />
 	  <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" />
 	  <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" />
diff --git a/src/Services/Ordering/Ordering.SignalrHub/Program.cs b/src/Services/Ordering/Ordering.SignalrHub/Program.cs
index 160855613..718f7760d 100644
--- a/src/Services/Ordering/Ordering.SignalrHub/Program.cs
+++ b/src/Services/Ordering/Ordering.SignalrHub/Program.cs
@@ -74,11 +74,16 @@ else
         return new DefaultRabbitMQPersistentConnection(factory, logger, retryCount);
     });
 }
+
 ConfigureAuthService(builder.Services, builder.Configuration);
 RegisterEventBus(builder.Services, builder.Configuration);
-builder.Services.AddOptions();
-builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
-builder.Host.ConfigureContainer<ContainerBuilder>(conBuilder => conBuilder.RegisterModule(new ApplicationModule()));
+builder.Services.AddSingleton<IIntegrationEventHandler<OrderStatusChangedToAwaitingValidationIntegrationEvent>, OrderStatusChangedToAwaitingValidationIntegrationEventHandler>();
+builder.Services.AddSingleton<IIntegrationEventHandler<OrderStatusChangedToCancelledIntegrationEvent>, OrderStatusChangedToCancelledIntegrationEventHandler>();
+builder.Services.AddSingleton<IIntegrationEventHandler<OrderStatusChangedToPaidIntegrationEvent>, OrderStatusChangedToPaidIntegrationEventHandler>();
+builder.Services.AddSingleton<IIntegrationEventHandler<OrderStatusChangedToShippedIntegrationEvent>, OrderStatusChangedToShippedIntegrationEventHandler>();
+builder.Services.AddSingleton<IIntegrationEventHandler<OrderStatusChangedToStockConfirmedIntegrationEvent>, OrderStatusChangedToStockConfirmedIntegrationEventHandler>();
+builder.Services.AddSingleton<IIntegrationEventHandler<OrderStatusChangedToSubmittedIntegrationEvent>, OrderStatusChangedToSubmittedIntegrationEventHandler>();
+
 var app = builder.Build();
 if (app.Environment.IsDevelopment())
 {
diff --git a/src/Services/Ordering/Ordering.UnitTests/Application/IdentifiedCommandHandlerTest.cs b/src/Services/Ordering/Ordering.UnitTests/Application/IdentifiedCommandHandlerTest.cs
index cf84bd880..79e17b234 100644
--- a/src/Services/Ordering/Ordering.UnitTests/Application/IdentifiedCommandHandlerTest.cs
+++ b/src/Services/Ordering/Ordering.UnitTests/Application/IdentifiedCommandHandlerTest.cs
@@ -28,8 +28,7 @@ public class IdentifiedCommandHandlerTest
 
         //Act
         var handler = new CreateOrderIdentifiedCommandHandler(_mediator.Object, _requestManager.Object, _loggerMock.Object);
-        var cltToken = new System.Threading.CancellationToken();
-        var result = await handler.Handle(fakeOrderCmd, cltToken);
+        var result = await handler.Handle(fakeOrderCmd, CancellationToken.None);
 
         //Assert
         Assert.True(result);
diff --git a/src/Services/Payment/Payment.API/GlobalUsings.cs b/src/Services/Payment/Payment.API/GlobalUsings.cs
index b064110ab..023296a1c 100644
--- a/src/Services/Payment/Payment.API/GlobalUsings.cs
+++ b/src/Services/Payment/Payment.API/GlobalUsings.cs
@@ -1,6 +1,4 @@
-global using Autofac.Extensions.DependencyInjection;
-global using Autofac;
-global using Azure.Core;
+global using Azure.Core;
 global using Azure.Identity;
 global using HealthChecks.UI.Client;
 global using Microsoft.AspNetCore.Diagnostics.HealthChecks;
diff --git a/src/Services/Payment/Payment.API/Payment.API.csproj b/src/Services/Payment/Payment.API/Payment.API.csproj
index 4e72c131e..f6b9637f0 100644
--- a/src/Services/Payment/Payment.API/Payment.API.csproj
+++ b/src/Services/Payment/Payment.API/Payment.API.csproj
@@ -12,7 +12,6 @@
     <PackageReference Include="AspNetCore.HealthChecks.AzureServiceBus" />
     <PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" />
     <PackageReference Include="AspNetCore.HealthChecks.UI.Client" />
-    <PackageReference Include="Autofac.Extensions.DependencyInjection" />
     <PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" />
     <PackageReference Include="Azure.Identity" />
     <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" />
diff --git a/src/Services/Services.Common/Services.Common.csproj b/src/Services/Services.Common/Services.Common.csproj
index 89ff64893..7756c425d 100644
--- a/src/Services/Services.Common/Services.Common.csproj
+++ b/src/Services/Services.Common/Services.Common.csproj
@@ -15,7 +15,6 @@
     <PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" />
     <PackageReference Include="AspNetCore.HealthChecks.SqlServer" />
     <PackageReference Include="AspNetCore.HealthChecks.UI.Client" />
-    <PackageReference Include="Autofac.Extensions.DependencyInjection" />
     <PackageReference Include="Duende.IdentityServer.AspNetIdentity" />
     <PackageReference Include="Duende.IdentityServer.EntityFramework.Storage" />
     <PackageReference Include="Duende.IdentityServer.EntityFramework" />
diff --git a/src/Services/Webhooks/Webhooks.API/GlobalUsings.cs b/src/Services/Webhooks/Webhooks.API/GlobalUsings.cs
index a2b8516f1..133a01cb1 100644
--- a/src/Services/Webhooks/Webhooks.API/GlobalUsings.cs
+++ b/src/Services/Webhooks/Webhooks.API/GlobalUsings.cs
@@ -1,6 +1,4 @@
-global using Autofac.Extensions.DependencyInjection;
-global using Autofac;
-global using HealthChecks.UI.Client;
+global using HealthChecks.UI.Client;
 global using Microsoft.AspNetCore.Authentication.JwtBearer;
 global using Microsoft.AspNetCore.Authorization;
 global using Microsoft.AspNetCore.Builder;
diff --git a/src/Services/Webhooks/Webhooks.API/Startup.cs b/src/Services/Webhooks/Webhooks.API/Startup.cs
index 10a923972..64cfe62e3 100644
--- a/src/Services/Webhooks/Webhooks.API/Startup.cs
+++ b/src/Services/Webhooks/Webhooks.API/Startup.cs
@@ -1,4 +1,4 @@
-namespace Webhooks.API;
+namespace Webhooks.API;
 public class Startup
 {
     public IConfiguration Configuration { get; }
@@ -26,10 +26,7 @@ public class Startup
             .AddTransient<IGrantUrlTesterService, GrantUrlTesterService>()
             .AddTransient<IWebhooksRetriever, WebhooksRetriever>()
             .AddTransient<IWebhooksSender, WebhooksSender>();
-
-        var container = new ContainerBuilder();
-        container.Populate(services);
-        return new AutofacServiceProvider(container.Build());
+        return services.BuildServiceProvider();
     }
 
     public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
diff --git a/src/Services/Webhooks/Webhooks.API/Webhooks.API.csproj b/src/Services/Webhooks/Webhooks.API/Webhooks.API.csproj
index 1bcdc8d69..4357a1520 100644
--- a/src/Services/Webhooks/Webhooks.API/Webhooks.API.csproj
+++ b/src/Services/Webhooks/Webhooks.API/Webhooks.API.csproj
@@ -12,7 +12,6 @@
   <ItemGroup>
     <PackageReference Include="AspNetCore.HealthChecks.SqlServer" />
     <PackageReference Include="AspNetCore.HealthChecks.UI.Client" />
-    <PackageReference Include="Autofac.Extensions.DependencyInjection" />
     <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" />
     <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" />
     <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" />