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 _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 @@ - 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 @@ - 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 @@ - - 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 @@ - 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 @@ - + @@ -44,7 +44,6 @@ - @@ -74,4 +73,4 @@ - + \ 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 @@ - - 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 @@ - 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(conBuilder => conBuilder.RegisterModule(new ApplicationModule())); +builder.Services.AddSingleton, OrderStatusChangedToAwaitingValidationIntegrationEventHandler>(); +builder.Services.AddSingleton, OrderStatusChangedToCancelledIntegrationEventHandler>(); +builder.Services.AddSingleton, OrderStatusChangedToPaidIntegrationEventHandler>(); +builder.Services.AddSingleton, OrderStatusChangedToShippedIntegrationEventHandler>(); +builder.Services.AddSingleton, OrderStatusChangedToStockConfirmedIntegrationEventHandler>(); +builder.Services.AddSingleton, 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 @@ - 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 @@ - 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() .AddTransient() .AddTransient(); - - 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 @@ -