diff --git a/src/1-BuildingBlocks/Application/Services/ApplicationExtensions.cs b/src/1-BuildingBlocks/Application/Services/ApplicationExtensions.cs deleted file mode 100644 index cd3f8f2df..000000000 --- a/src/1-BuildingBlocks/Application/Services/ApplicationExtensions.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using System; -using TaskoMask.BuildingBlocks.Application.Behaviors; -using TaskoMask.BuildingBlocks.Application.Exceptions; -using TaskoMask.BuildingBlocks.Application.Notifications; - -namespace TaskoMask.BuildingBlocks.Application.Services; - -public static class ApplicationExtensions -{ - /// - /// - /// - public static void AddBuildingBlocksApplication(this IServiceCollection services, Type validatorAssemblyMarkerType) - { - if (services == null) - throw new ArgumentNullException(nameof(services)); - - services.AddApplicationExceptionHandlers(); - services.AddApplicationBehaviors(validatorAssemblyMarkerType); - services.AddDomainNotificationHandler(); - } -} diff --git a/src/1-BuildingBlocks/Application/Services/ApplicationService.cs b/src/1-BuildingBlocks/Application/Services/ApplicationService.cs deleted file mode 100644 index fe449dc36..000000000 --- a/src/1-BuildingBlocks/Application/Services/ApplicationService.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using TaskoMask.BuildingBlocks.Application.Bus; - -namespace TaskoMask.BuildingBlocks.Application.Services; - -public abstract class ApplicationService : IApplicationService -{ - #region Fields - - - protected readonly IInMemoryBus _inMemoryBus; - - #endregion - - #region Ctors - - - public ApplicationService(IInMemoryBus inMemoryBus) - { - _inMemoryBus = inMemoryBus; - } - - #endregion - - - #region Public Methods - - - - /// - /// - /// - public void Dispose() - { - GC.SuppressFinalize(this); - } - - #endregion -} diff --git a/src/1-BuildingBlocks/Application/Services/IApplicationService.cs b/src/1-BuildingBlocks/Application/Services/IApplicationService.cs deleted file mode 100644 index 86debf813..000000000 --- a/src/1-BuildingBlocks/Application/Services/IApplicationService.cs +++ /dev/null @@ -1,3 +0,0 @@ -namespace TaskoMask.BuildingBlocks.Application.Services; - -public interface IApplicationService { } diff --git a/src/1-BuildingBlocks/Application/Behaviors/BehaviorExtensions.cs b/src/1-BuildingBlocks/Infrastructure/Behaviors/BehaviorExtensions.cs similarity index 95% rename from src/1-BuildingBlocks/Application/Behaviors/BehaviorExtensions.cs rename to src/1-BuildingBlocks/Infrastructure/Behaviors/BehaviorExtensions.cs index 3a064dd93..51c3a8658 100644 --- a/src/1-BuildingBlocks/Application/Behaviors/BehaviorExtensions.cs +++ b/src/1-BuildingBlocks/Infrastructure/Behaviors/BehaviorExtensions.cs @@ -4,7 +4,7 @@ using System; using TaskoMask.BuildingBlocks.Domain.Events; -namespace TaskoMask.BuildingBlocks.Application.Behaviors; +namespace TaskoMask.BuildingBlocks.Infrastructure.Behaviors; public static class BehaviorExtensions { diff --git a/src/1-BuildingBlocks/Application/Behaviors/CachingBehavior.cs b/src/1-BuildingBlocks/Infrastructure/Behaviors/CachingBehavior.cs similarity index 97% rename from src/1-BuildingBlocks/Application/Behaviors/CachingBehavior.cs rename to src/1-BuildingBlocks/Infrastructure/Behaviors/CachingBehavior.cs index 91d4875ba..957c995fd 100644 --- a/src/1-BuildingBlocks/Application/Behaviors/CachingBehavior.cs +++ b/src/1-BuildingBlocks/Infrastructure/Behaviors/CachingBehavior.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using TaskoMask.BuildingBlocks.Application.Queries; -namespace TaskoMask.BuildingBlocks.Application.Behaviors; +namespace TaskoMask.BuildingBlocks.Infrastructure.Behaviors; /// /// Caching response for queries that are mareked by ICacheableQuery diff --git a/src/1-BuildingBlocks/Application/Behaviors/EventStoringBehavior.cs b/src/1-BuildingBlocks/Infrastructure/Behaviors/EventStoringBehavior.cs similarity index 94% rename from src/1-BuildingBlocks/Application/Behaviors/EventStoringBehavior.cs rename to src/1-BuildingBlocks/Infrastructure/Behaviors/EventStoringBehavior.cs index 631f40678..4b33dbfa7 100644 --- a/src/1-BuildingBlocks/Application/Behaviors/EventStoringBehavior.cs +++ b/src/1-BuildingBlocks/Infrastructure/Behaviors/EventStoringBehavior.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using TaskoMask.BuildingBlocks.Domain.Events; -namespace TaskoMask.BuildingBlocks.Application.Behaviors; +namespace TaskoMask.BuildingBlocks.Infrastructure.Behaviors; /// /// Each command must have at least one event to save its changes in event store diff --git a/src/1-BuildingBlocks/Application/Behaviors/ValidationBehaviour.cs b/src/1-BuildingBlocks/Infrastructure/Behaviors/ValidationBehaviour.cs similarity index 95% rename from src/1-BuildingBlocks/Application/Behaviors/ValidationBehaviour.cs rename to src/1-BuildingBlocks/Infrastructure/Behaviors/ValidationBehaviour.cs index 5406f3053..b03147ecf 100644 --- a/src/1-BuildingBlocks/Application/Behaviors/ValidationBehaviour.cs +++ b/src/1-BuildingBlocks/Infrastructure/Behaviors/ValidationBehaviour.cs @@ -8,7 +8,7 @@ using TaskoMask.BuildingBlocks.Application.Notifications; using TaskoMask.BuildingBlocks.Contracts.Extensions; -namespace TaskoMask.BuildingBlocks.Application.Behaviors; +namespace TaskoMask.BuildingBlocks.Infrastructure.Behaviors; /// /// Automatic validation by checking data annotation and fluent validations (if any) @@ -49,7 +49,7 @@ public async Task Handle(TRequest request, CancellationToken cancella var isValidDataAnnotationValidation = ValidateDataAnnotationValidation(request); if (!isValidFluentValidation || !isValidDataAnnotationValidation) - throw new Exceptions.ValidationException(); + throw new Application.Exceptions.ValidationException(); return await next(); } diff --git a/src/1-BuildingBlocks/Application/Exceptions/ExceptionExtensions.cs b/src/1-BuildingBlocks/Infrastructure/Exceptions/ExceptionExtensions.cs similarity index 93% rename from src/1-BuildingBlocks/Application/Exceptions/ExceptionExtensions.cs rename to src/1-BuildingBlocks/Infrastructure/Exceptions/ExceptionExtensions.cs index 4f08ce6af..a57bb3e4c 100644 --- a/src/1-BuildingBlocks/Application/Exceptions/ExceptionExtensions.cs +++ b/src/1-BuildingBlocks/Infrastructure/Exceptions/ExceptionExtensions.cs @@ -1,7 +1,7 @@ using MediatR.Pipeline; using Microsoft.Extensions.DependencyInjection; -namespace TaskoMask.BuildingBlocks.Application.Exceptions; +namespace TaskoMask.BuildingBlocks.Infrastructure.Exceptions; public static class ExceptionExtensions { diff --git a/src/1-BuildingBlocks/Application/Exceptions/ManagedExceptionHandler.cs b/src/1-BuildingBlocks/Infrastructure/Exceptions/ManagedExceptionHandler.cs similarity index 96% rename from src/1-BuildingBlocks/Application/Exceptions/ManagedExceptionHandler.cs rename to src/1-BuildingBlocks/Infrastructure/Exceptions/ManagedExceptionHandler.cs index 2436770a4..2b07bf461 100644 --- a/src/1-BuildingBlocks/Application/Exceptions/ManagedExceptionHandler.cs +++ b/src/1-BuildingBlocks/Infrastructure/Exceptions/ManagedExceptionHandler.cs @@ -6,7 +6,7 @@ using TaskoMask.BuildingBlocks.Application.Notifications; using TaskoMask.BuildingBlocks.Contracts.Exceptions; -namespace TaskoMask.BuildingBlocks.Application.Exceptions; +namespace TaskoMask.BuildingBlocks.Infrastructure.Exceptions; /// /// Handle all managed exceptions (DomainException,ApplicationException,ValidationException) diff --git a/src/1-BuildingBlocks/Application/Exceptions/UnmanagedExceptionHandler.cs b/src/1-BuildingBlocks/Infrastructure/Exceptions/UnmanagedExceptionHandler.cs similarity index 95% rename from src/1-BuildingBlocks/Application/Exceptions/UnmanagedExceptionHandler.cs rename to src/1-BuildingBlocks/Infrastructure/Exceptions/UnmanagedExceptionHandler.cs index 44d1c55b8..7864fa76b 100644 --- a/src/1-BuildingBlocks/Application/Exceptions/UnmanagedExceptionHandler.cs +++ b/src/1-BuildingBlocks/Infrastructure/Exceptions/UnmanagedExceptionHandler.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using TaskoMask.BuildingBlocks.Application.Notifications; -namespace TaskoMask.BuildingBlocks.Application.Exceptions; +namespace TaskoMask.BuildingBlocks.Infrastructure.Exceptions; /// /// Handle all unmanaged exceptions diff --git a/src/1-BuildingBlocks/Infrastructure/Extensions/InfrastructureExtensions.cs b/src/1-BuildingBlocks/Infrastructure/Extensions/InfrastructureExtensions.cs index eaf41a868..ad5e782db 100644 --- a/src/1-BuildingBlocks/Infrastructure/Extensions/InfrastructureExtensions.cs +++ b/src/1-BuildingBlocks/Infrastructure/Extensions/InfrastructureExtensions.cs @@ -1,8 +1,11 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using System; +using TaskoMask.BuildingBlocks.Infrastructure.Behaviors; using TaskoMask.BuildingBlocks.Infrastructure.Bus; using TaskoMask.BuildingBlocks.Infrastructure.EventSourcing; +using TaskoMask.BuildingBlocks.Infrastructure.Exceptions; +using TaskoMask.BuildingBlocks.Infrastructure.Notifications; namespace TaskoMask.BuildingBlocks.Infrastructure.Extensions; @@ -15,9 +18,14 @@ public static void AddBuildingBlocksInfrastructure( this IServiceCollection services, IConfiguration configuration, Type consumerAssemblyMarkerType, - Type handlerAssemblyMarkerType + Type handlerAssemblyMarkerType, + Type validatorAssemblyMarkerType ) { + services.AddApplicationExceptionHandlers(); + services.AddApplicationBehaviors(validatorAssemblyMarkerType); + services.AddDomainNotificationHandler(); + services.AddInMemoryBus(handlerAssemblyMarkerType); services.AddMessageBus(configuration, consumerAssemblyMarkerType); services.AddRedisEventStoreService(); diff --git a/src/1-BuildingBlocks/Application/Notifications/NotificationHandler.cs b/src/1-BuildingBlocks/Infrastructure/Notifications/NotificationHandler.cs similarity index 89% rename from src/1-BuildingBlocks/Application/Notifications/NotificationHandler.cs rename to src/1-BuildingBlocks/Infrastructure/Notifications/NotificationHandler.cs index 009cc4081..0584c7802 100644 --- a/src/1-BuildingBlocks/Application/Notifications/NotificationHandler.cs +++ b/src/1-BuildingBlocks/Infrastructure/Notifications/NotificationHandler.cs @@ -1,7 +1,8 @@ using System.Collections.Generic; using System.Linq; +using TaskoMask.BuildingBlocks.Application.Notifications; -namespace TaskoMask.BuildingBlocks.Application.Notifications; +namespace TaskoMask.BuildingBlocks.Infrastructure.Notifications; /// /// diff --git a/src/1-BuildingBlocks/Application/Notifications/NotificationsExtensions.cs b/src/1-BuildingBlocks/Infrastructure/Notifications/NotificationsExtensions.cs similarity index 72% rename from src/1-BuildingBlocks/Application/Notifications/NotificationsExtensions.cs rename to src/1-BuildingBlocks/Infrastructure/Notifications/NotificationsExtensions.cs index a52663a8e..43b868597 100644 --- a/src/1-BuildingBlocks/Application/Notifications/NotificationsExtensions.cs +++ b/src/1-BuildingBlocks/Infrastructure/Notifications/NotificationsExtensions.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.DependencyInjection; +using TaskoMask.BuildingBlocks.Application.Notifications; -namespace TaskoMask.BuildingBlocks.Application.Notifications; +namespace TaskoMask.BuildingBlocks.Infrastructure.Notifications; public static class NotificationsExtensions { diff --git a/src/2-Services/Boards/Api/Boards.Read.Api/Infrastructure/DI/ModuleExtensions.cs b/src/2-Services/Boards/Api/Boards.Read.Api/Infrastructure/DI/ModuleExtensions.cs index ba540478c..fa59f5b40 100644 --- a/src/2-Services/Boards/Api/Boards.Read.Api/Infrastructure/DI/ModuleExtensions.cs +++ b/src/2-Services/Boards/Api/Boards.Read.Api/Infrastructure/DI/ModuleExtensions.cs @@ -1,10 +1,8 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using TaskoMask.BuildingBlocks.Application.Services; using TaskoMask.BuildingBlocks.Infrastructure.Extensions; using TaskoMask.BuildingBlocks.Infrastructure.Mapping; using TaskoMask.BuildingBlocks.Infrastructure.MongoDB; -using TaskoMask.Services.Boards.Read.Api.Features.Boards.GetBoardById; using TaskoMask.Services.Boards.Read.Api.Infrastructure.DbContext; using TaskoMask.Services.Boards.Read.Api.Infrastructure.Mapper; @@ -23,11 +21,10 @@ public static void AddModules(this IServiceCollection services, IConfiguration c services.AddBuildingBlocksInfrastructure( configuration, consumerAssemblyMarkerType: typeof(Program), - handlerAssemblyMarkerType: typeof(GetBoardByIdHandler) + handlerAssemblyMarkerType: typeof(Program), + validatorAssemblyMarkerType: typeof(Program) ); - services.AddBuildingBlocksApplication(validatorAssemblyMarkerType: typeof(Program)); - services.AddMapper(typeof(MappingProfile)); services.AddMongoDbContext(configuration); diff --git a/src/2-Services/Boards/Api/Boards.Write.Api/Configuration/HostingExtensions.cs b/src/2-Services/Boards/Api/Boards.Write.Api/Configuration/HostingExtensions.cs index 8a73f9147..a50e83203 100644 --- a/src/2-Services/Boards/Api/Boards.Write.Api/Configuration/HostingExtensions.cs +++ b/src/2-Services/Boards/Api/Boards.Write.Api/Configuration/HostingExtensions.cs @@ -17,7 +17,7 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde { builder.AddCustomSerilog(); - builder.Services.AddModules(builder.Configuration, consumerAssemblyMarkerType: typeof(Program)); + builder.Services.AddModules(builder.Configuration); builder.Services.AddWebApiPreConfigured(builder.Configuration); diff --git a/src/2-Services/Boards/Api/Boards.Write.Api/Infrastructure/CrossCutting/DI/ApplicationModule.cs b/src/2-Services/Boards/Api/Boards.Write.Api/Infrastructure/CrossCutting/DI/ApplicationModule.cs deleted file mode 100644 index 4f3013c03..000000000 --- a/src/2-Services/Boards/Api/Boards.Write.Api/Infrastructure/CrossCutting/DI/ApplicationModule.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using TaskoMask.BuildingBlocks.Application.Services; -using TaskoMask.Services.Boards.Write.Api.Resources; - -namespace TaskoMask.Services.Boards.Write.Api.Infrastructure.CrossCutting.DI; - -/// -/// -/// -internal static class ApplicationModule -{ - /// - /// - /// - public static void AddApplicationModule(this IServiceCollection services) - { - services.AddBuildingBlocksApplication(validatorAssemblyMarkerType: typeof(ApplicationMessages)); - } -} diff --git a/src/2-Services/Boards/Api/Boards.Write.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs b/src/2-Services/Boards/Api/Boards.Write.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs index dcf97088d..3d36ca915 100644 --- a/src/2-Services/Boards/Api/Boards.Write.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs +++ b/src/2-Services/Boards/Api/Boards.Write.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using System; using TaskoMask.BuildingBlocks.Infrastructure.Extensions; using TaskoMask.BuildingBlocks.Infrastructure.MongoDB; using TaskoMask.Services.Boards.Write.Api.Domain.Boards.Data; @@ -8,7 +7,6 @@ using TaskoMask.Services.Boards.Write.Api.Infrastructure.Data.DbContext; using TaskoMask.Services.Boards.Write.Api.Infrastructure.Data.Repositories; using TaskoMask.Services.Boards.Write.Api.Infrastructure.Data.Services; -using TaskoMask.Services.Boards.Write.Api.Resources; namespace TaskoMask.Services.Boards.Write.Api.Infrastructure.CrossCutting.DI; @@ -20,9 +18,14 @@ public static class InfrastructureModule /// /// /// - public static void AddInfrastructureModule(this IServiceCollection services, IConfiguration configuration, Type consumerAssemblyMarkerType) + public static void AddInfrastructureModule(this IServiceCollection services, IConfiguration configuration) { - services.AddBuildingBlocksInfrastructure(configuration, consumerAssemblyMarkerType, handlerAssemblyMarkerType: typeof(ApplicationMessages)); + services.AddBuildingBlocksInfrastructure( + configuration, + consumerAssemblyMarkerType: typeof(Program), + validatorAssemblyMarkerType: typeof(Program), + handlerAssemblyMarkerType: typeof(Program) + ); services.AddMongoDbContext(configuration); diff --git a/src/2-Services/Boards/Api/Boards.Write.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs b/src/2-Services/Boards/Api/Boards.Write.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs index bb346652d..64d48ef2e 100644 --- a/src/2-Services/Boards/Api/Boards.Write.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs +++ b/src/2-Services/Boards/Api/Boards.Write.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using System; namespace TaskoMask.Services.Boards.Write.Api.Infrastructure.CrossCutting.DI; @@ -12,10 +11,8 @@ public static class ModuleExtensions /// /// /// - public static void AddModules(this IServiceCollection services, IConfiguration configuration, Type consumerAssemblyMarkerType) + public static void AddModules(this IServiceCollection services, IConfiguration configuration) { - services.AddInfrastructureModule(configuration, consumerAssemblyMarkerType); - - services.AddApplicationModule(); + services.AddInfrastructureModule(configuration); } } diff --git a/src/2-Services/Boards/Tests/Boards.Write.Tests.Integration/Fixtures/TestsBaseFixture.cs b/src/2-Services/Boards/Tests/Boards.Write.Tests.Integration/Fixtures/TestsBaseFixture.cs index af4ce8e91..3a0bd044c 100644 --- a/src/2-Services/Boards/Tests/Boards.Write.Tests.Integration/Fixtures/TestsBaseFixture.cs +++ b/src/2-Services/Boards/Tests/Boards.Write.Tests.Integration/Fixtures/TestsBaseFixture.cs @@ -79,7 +79,7 @@ public override IServiceProvider GetServiceProvider(string dbNameSuffix) return configuration; }); - services.AddModules(configuration, typeof(TestsBaseFixture)); + services.AddModules(configuration); var serviceProvider = services.BuildServiceProvider(); diff --git a/src/2-Services/Identity/Api/Identity.Api/Configuration/HostingExtensions.cs b/src/2-Services/Identity/Api/Identity.Api/Configuration/HostingExtensions.cs index 08962dff3..e005646f8 100644 --- a/src/2-Services/Identity/Api/Identity.Api/Configuration/HostingExtensions.cs +++ b/src/2-Services/Identity/Api/Identity.Api/Configuration/HostingExtensions.cs @@ -5,7 +5,6 @@ using TaskoMask.BuildingBlocks.Web.MVC.Configuration.Captcha; using TaskoMask.BuildingBlocks.Web.MVC.Configuration.MVC; using TaskoMask.BuildingBlocks.Web.MVC.Configuration.Serilog; -using TaskoMask.Services.Identity.Api.Consumers; using TaskoMask.Services.Identity.Api.Infrastructure.CrossCutting.DI; namespace TaskoMask.Services.Identity.Api.Configuration; @@ -21,7 +20,7 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde builder.Services.AddRazorPagesPreConfigured(builder.Configuration); - builder.Services.AddModules(builder.Configuration, consumerAssemblyMarkerType: typeof(OwnerRegisteredConsumer)); + builder.Services.AddModules(builder.Configuration); builder.Services.AddIdentityServer(); diff --git a/src/2-Services/Identity/Api/Identity.Api/Infrastructure/CrossCutting/DI/ApplicationModule.cs b/src/2-Services/Identity/Api/Identity.Api/Infrastructure/CrossCutting/DI/ApplicationModule.cs deleted file mode 100644 index 767cbdbf6..000000000 --- a/src/2-Services/Identity/Api/Identity.Api/Infrastructure/CrossCutting/DI/ApplicationModule.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using TaskoMask.BuildingBlocks.Application.Services; -using TaskoMask.Services.Identity.Api.UseCases.UpdateUser; - -namespace TaskoMask.Services.Identity.Api.Infrastructure.CrossCutting.DI; - -/// -/// -/// -internal static class ApplicationModule -{ - /// - /// - /// - public static void AddApplicationModule(this IServiceCollection services) - { - services.AddBuildingBlocksApplication(typeof(UpdateUserValidation<>)); - } -} diff --git a/src/2-Services/Identity/Api/Identity.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs b/src/2-Services/Identity/Api/Identity.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs index 161717a2e..c3fa9d891 100644 --- a/src/2-Services/Identity/Api/Identity.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs +++ b/src/2-Services/Identity/Api/Identity.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs @@ -6,7 +6,6 @@ using TaskoMask.Services.Identity.Api.Infrastructure.CrossCutting.AspNetIdentity; using TaskoMask.Services.Identity.Api.Infrastructure.CrossCutting.Mapper; using TaskoMask.Services.Identity.Api.Infrastructure.Data.DbContext; -using TaskoMask.Services.Identity.Api.UseCases.RegisterUser; namespace TaskoMask.Services.Identity.Api.Infrastructure.CrossCutting.DI; @@ -18,9 +17,14 @@ public static class InfrastructureModule /// /// /// - public static void AddInfrastructureModule(this IServiceCollection services, IConfiguration configuration, Type consumerAssemblyMarkerType) + public static void AddInfrastructureModule(this IServiceCollection services, IConfiguration configuration) { - services.AddBuildingBlocksInfrastructure(configuration, consumerAssemblyMarkerType, handlerAssemblyMarkerType: typeof(RegisterUserUseCase)); + services.AddBuildingBlocksInfrastructure( + configuration, + consumerAssemblyMarkerType: typeof(Program), + handlerAssemblyMarkerType: typeof(Program), + validatorAssemblyMarkerType: typeof(Program) + ); services.AddMapper(typeof(MappingProfile)); diff --git a/src/2-Services/Identity/Api/Identity.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs b/src/2-Services/Identity/Api/Identity.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs index 21aba1f12..fba51c714 100644 --- a/src/2-Services/Identity/Api/Identity.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs +++ b/src/2-Services/Identity/Api/Identity.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using System; namespace TaskoMask.Services.Identity.Api.Infrastructure.CrossCutting.DI; @@ -12,10 +11,8 @@ public static class ModuleExtensions /// /// /// - public static void AddModules(this IServiceCollection services, IConfiguration configuration, Type consumerAssemblyMarkerType) + public static void AddModules(this IServiceCollection services, IConfiguration configuration) { - services.AddInfrastructureModule(configuration, consumerAssemblyMarkerType); - - services.AddApplicationModule(); + services.AddInfrastructureModule(configuration); } } diff --git a/src/2-Services/Identity/Tests/Identity.Tests.Integration/Fixtures/TestsBaseFixture.cs b/src/2-Services/Identity/Tests/Identity.Tests.Integration/Fixtures/TestsBaseFixture.cs index 0bbdb121b..b030ab2bf 100644 --- a/src/2-Services/Identity/Tests/Identity.Tests.Integration/Fixtures/TestsBaseFixture.cs +++ b/src/2-Services/Identity/Tests/Identity.Tests.Integration/Fixtures/TestsBaseFixture.cs @@ -50,7 +50,7 @@ public override IServiceProvider GetServiceProvider(string dbNameSuffix) services.AddLogging(); - services.AddModules(configuration, typeof(TestsBaseFixture)); + services.AddModules(configuration); var serviceProvider = services.BuildServiceProvider(); diff --git a/src/2-Services/Owners/Api/Owners.Read.Api/Infrastructure/DI/ModuleExtensions.cs b/src/2-Services/Owners/Api/Owners.Read.Api/Infrastructure/DI/ModuleExtensions.cs index 08b91c91d..0467ff20f 100644 --- a/src/2-Services/Owners/Api/Owners.Read.Api/Infrastructure/DI/ModuleExtensions.cs +++ b/src/2-Services/Owners/Api/Owners.Read.Api/Infrastructure/DI/ModuleExtensions.cs @@ -1,11 +1,8 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using TaskoMask.BuildingBlocks.Application.Services; using TaskoMask.BuildingBlocks.Infrastructure.Extensions; using TaskoMask.BuildingBlocks.Infrastructure.Mapping; using TaskoMask.BuildingBlocks.Infrastructure.MongoDB; -using TaskoMask.Services.Owners.Read.Api.Consumers.Owners; -using TaskoMask.Services.Owners.Read.Api.Features.Owners.GetOwnerById; using TaskoMask.Services.Owners.Read.Api.Infrastructure.DbContext; using TaskoMask.Services.Owners.Read.Api.Infrastructure.Mapper; @@ -23,12 +20,11 @@ public static void AddModules(this IServiceCollection services, IConfiguration c { services.AddBuildingBlocksInfrastructure( configuration, - consumerAssemblyMarkerType: typeof(OwnerRegisterationCompletedConsumer), - handlerAssemblyMarkerType: typeof(GetOwnerByIdHandler) + consumerAssemblyMarkerType: typeof(Program), + validatorAssemblyMarkerType: typeof(Program), + handlerAssemblyMarkerType: typeof(Program) ); - services.AddBuildingBlocksApplication(validatorAssemblyMarkerType: typeof(Program)); - services.AddMapper(typeof(MappingProfile)); services.AddMongoDbContext(configuration); diff --git a/src/2-Services/Owners/Api/Owners.Write.Api/Configuration/HostingExtensions.cs b/src/2-Services/Owners/Api/Owners.Write.Api/Configuration/HostingExtensions.cs index c56e6cec6..c7e669e43 100644 --- a/src/2-Services/Owners/Api/Owners.Write.Api/Configuration/HostingExtensions.cs +++ b/src/2-Services/Owners/Api/Owners.Write.Api/Configuration/HostingExtensions.cs @@ -3,7 +3,6 @@ using Serilog; using TaskoMask.BuildingBlocks.Web.MVC.Configuration.MVC; using TaskoMask.BuildingBlocks.Web.MVC.Configuration.Serilog; -using TaskoMask.Services.Owners.Write.Api.Consumers; using TaskoMask.Services.Owners.Write.Api.Infrastructure.CrossCutting.DI; using TaskoMask.Services.Owners.Write.Api.Infrastructure.Data.DbContext; @@ -18,7 +17,7 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde { builder.AddCustomSerilog(); - builder.Services.AddModules(builder.Configuration, consumerAssemblyMarkerType: typeof(UserRegisteredConsumer)); + builder.Services.AddModules(builder.Configuration); builder.Services.AddWebApiPreConfigured(builder.Configuration); diff --git a/src/2-Services/Owners/Api/Owners.Write.Api/Infrastructure/CrossCutting/DI/ApplicationModule.cs b/src/2-Services/Owners/Api/Owners.Write.Api/Infrastructure/CrossCutting/DI/ApplicationModule.cs deleted file mode 100644 index 629f1b2d8..000000000 --- a/src/2-Services/Owners/Api/Owners.Write.Api/Infrastructure/CrossCutting/DI/ApplicationModule.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using TaskoMask.BuildingBlocks.Application.Services; -using TaskoMask.Services.Owners.Write.Api.UseCases.Owners.RegisterOwner; - -namespace TaskoMask.Services.Owners.Write.Api.Infrastructure.CrossCutting.DI; - -/// -/// -/// -internal static class ApplicationModule -{ - /// - /// - /// - public static void AddApplicationModule(this IServiceCollection services) - { - services.AddBuildingBlocksApplication(validatorAssemblyMarkerType: typeof(RegiserOwnerValidation<>)); - } -} diff --git a/src/2-Services/Owners/Api/Owners.Write.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs b/src/2-Services/Owners/Api/Owners.Write.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs index 6ce57eb0a..1ab6024b7 100644 --- a/src/2-Services/Owners/Api/Owners.Write.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs +++ b/src/2-Services/Owners/Api/Owners.Write.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using System; using TaskoMask.BuildingBlocks.Infrastructure.Extensions; using TaskoMask.BuildingBlocks.Infrastructure.MongoDB; using TaskoMask.Services.Owners.Write.Api.Domain.Owners.Data; @@ -8,7 +7,6 @@ using TaskoMask.Services.Owners.Write.Api.Infrastructure.Data.DbContext; using TaskoMask.Services.Owners.Write.Api.Infrastructure.Data.Repositories; using TaskoMask.Services.Owners.Write.Api.Infrastructure.Data.Services; -using TaskoMask.Services.Owners.Write.Api.UseCases.Owners.RegisterOwner; namespace TaskoMask.Services.Owners.Write.Api.Infrastructure.CrossCutting.DI; @@ -20,9 +18,14 @@ public static class InfrastructureModule /// /// /// - public static void AddInfrastructureModule(this IServiceCollection services, IConfiguration configuration, Type consumerAssemblyMarkerType) + public static void AddInfrastructureModule(this IServiceCollection services, IConfiguration configuration) { - services.AddBuildingBlocksInfrastructure(configuration, consumerAssemblyMarkerType, typeof(RegiserOwnerUseCase)); + services.AddBuildingBlocksInfrastructure( + configuration, + consumerAssemblyMarkerType: typeof(Program), + handlerAssemblyMarkerType: typeof(Program), + validatorAssemblyMarkerType: typeof(Program) + ); services.AddMongoDbContext(configuration); diff --git a/src/2-Services/Owners/Api/Owners.Write.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs b/src/2-Services/Owners/Api/Owners.Write.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs index 30cba0b3e..e80d66f13 100644 --- a/src/2-Services/Owners/Api/Owners.Write.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs +++ b/src/2-Services/Owners/Api/Owners.Write.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using System; namespace TaskoMask.Services.Owners.Write.Api.Infrastructure.CrossCutting.DI; @@ -12,10 +11,8 @@ public static class ModuleExtensions /// /// /// - public static void AddModules(this IServiceCollection services, IConfiguration configuration, Type consumerAssemblyMarkerType) + public static void AddModules(this IServiceCollection services, IConfiguration configuration) { - services.AddInfrastructureModule(configuration, consumerAssemblyMarkerType); - - services.AddApplicationModule(); + services.AddInfrastructureModule(configuration); } } diff --git a/src/2-Services/Owners/Tests/Owners.Write.Tests.Integration/Fixtures/TestsBaseFixture.cs b/src/2-Services/Owners/Tests/Owners.Write.Tests.Integration/Fixtures/TestsBaseFixture.cs index 6007f65a4..de8077ddc 100644 --- a/src/2-Services/Owners/Tests/Owners.Write.Tests.Integration/Fixtures/TestsBaseFixture.cs +++ b/src/2-Services/Owners/Tests/Owners.Write.Tests.Integration/Fixtures/TestsBaseFixture.cs @@ -79,7 +79,7 @@ public override IServiceProvider GetServiceProvider(string dbNameSuffix) return configuration; }); - services.AddModules(configuration, typeof(TestsBaseFixture)); + services.AddModules(configuration); var serviceProvider = services.BuildServiceProvider(); diff --git a/src/2-Services/Tasks/Api/Tasks.Read.Api/Infrastructure/DI/ModuleExtensions.cs b/src/2-Services/Tasks/Api/Tasks.Read.Api/Infrastructure/DI/ModuleExtensions.cs index 061e1eb91..78e7bc9ea 100644 --- a/src/2-Services/Tasks/Api/Tasks.Read.Api/Infrastructure/DI/ModuleExtensions.cs +++ b/src/2-Services/Tasks/Api/Tasks.Read.Api/Infrastructure/DI/ModuleExtensions.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using TaskoMask.BuildingBlocks.Application.Services; using TaskoMask.BuildingBlocks.Infrastructure.Extensions; using TaskoMask.BuildingBlocks.Infrastructure.Mapping; using TaskoMask.BuildingBlocks.Infrastructure.MongoDB; @@ -22,11 +21,10 @@ public static void AddModules(this IServiceCollection services, IConfiguration c services.AddBuildingBlocksInfrastructure( configuration, consumerAssemblyMarkerType: typeof(Program), - handlerAssemblyMarkerType: typeof(Program) + handlerAssemblyMarkerType: typeof(Program), + validatorAssemblyMarkerType: typeof(Program) ); - services.AddBuildingBlocksApplication(validatorAssemblyMarkerType: typeof(Program)); - services.AddMapper(typeof(MappingProfile)); services.AddMongoDbContext(configuration); diff --git a/src/2-Services/Tasks/Api/Tasks.Write.Api/Configuration/HostingExtensions.cs b/src/2-Services/Tasks/Api/Tasks.Write.Api/Configuration/HostingExtensions.cs index aa9936a33..978456bb0 100644 --- a/src/2-Services/Tasks/Api/Tasks.Write.Api/Configuration/HostingExtensions.cs +++ b/src/2-Services/Tasks/Api/Tasks.Write.Api/Configuration/HostingExtensions.cs @@ -17,7 +17,7 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde { builder.AddCustomSerilog(); - builder.Services.AddModules(builder.Configuration, consumerAssemblyMarkerType: typeof(Program)); + builder.Services.AddModules(builder.Configuration); builder.Services.AddWebApiPreConfigured(builder.Configuration); diff --git a/src/2-Services/Tasks/Api/Tasks.Write.Api/Infrastructure/CrossCutting/DI/ApplicationModule.cs b/src/2-Services/Tasks/Api/Tasks.Write.Api/Infrastructure/CrossCutting/DI/ApplicationModule.cs deleted file mode 100644 index 0363f795c..000000000 --- a/src/2-Services/Tasks/Api/Tasks.Write.Api/Infrastructure/CrossCutting/DI/ApplicationModule.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using TaskoMask.BuildingBlocks.Application.Services; -using TaskoMask.Services.Tasks.Write.Api.Resources; - -namespace TaskoMask.Services.Tasks.Write.Api.Infrastructure.CrossCutting.DI; - -/// -/// -/// -internal static class ApplicationModule -{ - /// - /// - /// - public static void AddApplicationModule(this IServiceCollection services) - { - services.AddBuildingBlocksApplication(validatorAssemblyMarkerType: typeof(ApplicationMessages)); - } -} diff --git a/src/2-Services/Tasks/Api/Tasks.Write.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs b/src/2-Services/Tasks/Api/Tasks.Write.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs index 6bf77b901..0c6bb4cad 100644 --- a/src/2-Services/Tasks/Api/Tasks.Write.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs +++ b/src/2-Services/Tasks/Api/Tasks.Write.Api/Infrastructure/CrossCutting/DI/InfrastructureModule.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using System; using TaskoMask.BuildingBlocks.Infrastructure.Extensions; using TaskoMask.BuildingBlocks.Infrastructure.MongoDB; using TaskoMask.Services.Tasks.Write.Api.Domain.Tasks.Data; @@ -8,7 +7,6 @@ using TaskoMask.Services.Tasks.Write.Api.Infrastructure.Data.DbContext; using TaskoMask.Services.Tasks.Write.Api.Infrastructure.Data.Repositories; using TaskoMask.Services.Tasks.Write.Api.Infrastructure.Data.Services; -using TaskoMask.Services.Tasks.Write.Api.Resources; namespace TaskoMask.Services.Tasks.Write.Api.Infrastructure.CrossCutting.DI; @@ -20,9 +18,14 @@ public static class InfrastructureModule /// /// /// - public static void AddInfrastructureModule(this IServiceCollection services, IConfiguration configuration, Type consumerAssemblyMarkerType) + public static void AddInfrastructureModule(this IServiceCollection services, IConfiguration configuration) { - services.AddBuildingBlocksInfrastructure(configuration, consumerAssemblyMarkerType, handlerAssemblyMarkerType: typeof(ApplicationMessages)); + services.AddBuildingBlocksInfrastructure( + configuration, + typeof(Program), + handlerAssemblyMarkerType: typeof(Program), + validatorAssemblyMarkerType: typeof(Program) + ); services.AddMongoDbContext(configuration); diff --git a/src/2-Services/Tasks/Api/Tasks.Write.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs b/src/2-Services/Tasks/Api/Tasks.Write.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs index 07daf13c2..38924fe23 100644 --- a/src/2-Services/Tasks/Api/Tasks.Write.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs +++ b/src/2-Services/Tasks/Api/Tasks.Write.Api/Infrastructure/CrossCutting/DI/ModuleExtensions.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using System; namespace TaskoMask.Services.Tasks.Write.Api.Infrastructure.CrossCutting.DI; @@ -12,10 +11,8 @@ public static class ModuleExtensions /// /// /// - public static void AddModules(this IServiceCollection services, IConfiguration configuration, Type consumerAssemblyMarkerType) + public static void AddModules(this IServiceCollection services, IConfiguration configuration) { - services.AddInfrastructureModule(configuration, consumerAssemblyMarkerType); - - services.AddApplicationModule(); + services.AddInfrastructureModule(configuration); } } diff --git a/src/2-Services/Tasks/Tests/Tasks.Write.Tests.Integration/Fixtures/TestsBaseFixture.cs b/src/2-Services/Tasks/Tests/Tasks.Write.Tests.Integration/Fixtures/TestsBaseFixture.cs index 73d48754b..6c581a7fa 100644 --- a/src/2-Services/Tasks/Tests/Tasks.Write.Tests.Integration/Fixtures/TestsBaseFixture.cs +++ b/src/2-Services/Tasks/Tests/Tasks.Write.Tests.Integration/Fixtures/TestsBaseFixture.cs @@ -81,7 +81,7 @@ public override IServiceProvider GetServiceProvider(string dbNameSuffix) return configuration; }); - services.AddModules(configuration, typeof(TestsBaseFixture)); + services.AddModules(configuration); var serviceProvider = services.BuildServiceProvider(); diff --git a/src/3-ApiGateways/UserPanel/Aggregator/Infrastructure/DI/ModuleExtensions.cs b/src/3-ApiGateways/UserPanel/Aggregator/Infrastructure/DI/ModuleExtensions.cs index e056229ef..0a3175ad1 100644 --- a/src/3-ApiGateways/UserPanel/Aggregator/Infrastructure/DI/ModuleExtensions.cs +++ b/src/3-ApiGateways/UserPanel/Aggregator/Infrastructure/DI/ModuleExtensions.cs @@ -1,6 +1,4 @@ -using TaskoMask.ApiGateways.UserPanel.Aggregator.Features.GetBoardById; -using TaskoMask.ApiGateways.UserPanel.Aggregator.Infrastructure.Mapper; -using TaskoMask.BuildingBlocks.Application.Services; +using TaskoMask.ApiGateways.UserPanel.Aggregator.Infrastructure.Mapper; using TaskoMask.BuildingBlocks.Infrastructure.Extensions; using TaskoMask.BuildingBlocks.Infrastructure.Mapping; @@ -19,11 +17,10 @@ public static void AddModules(this IServiceCollection services, IConfiguration c services.AddBuildingBlocksInfrastructure( configuration, consumerAssemblyMarkerType: typeof(Program), - handlerAssemblyMarkerType: typeof(GetBoardByIdHandler) + handlerAssemblyMarkerType: typeof(Program), + validatorAssemblyMarkerType: typeof(Program) ); - services.AddBuildingBlocksApplication(validatorAssemblyMarkerType: typeof(Program)); - services.AddMapper(typeof(MappingProfile)); } }