• Exams of ASP.NET - Managing the shopping cart - Revisiting the CQRS pattern - The message broker - What is a Modular Monolith?

    Inside the aggregator – Modular Monolith

    The aggregator application is like an empty shell that loads the other assemblies and configures the cross-cutting concerns. It references the modules, then assembles and boots the application. Here’s the first part of the Program.cs file: using FluentValidation;using FluentValidation.AspNetCore;using MassTransit;using REPR.API.HttpClient;using REPR.Baskets;using REPR.Products;using System.Reflection;var builder = WebApplication.CreateBuilder(args);// Register fluent validationbuilder.AddFluentValidationEndpointFilter();builder.Services    .AddFluentValidationAutoValidation()    .AddValidatorsFromAssemblies(new[] {        Assembly.GetExecutingAssembly(),        Assembly.GetAssembly(typeof(BasketModuleExtensions)),        Assembly.GetAssembly(typeof(ProductsModuleExtensions)),    });builder.AddApiHttpClient();builder.AddExceptionMapper();builder    .AddBasketModule()    .AddProductsModule();builder.Services.AddMassTransit(x =>{    x.SetKebabCaseEndpointNameFormatter();    x.UsingInMemory((context, cfg) =>    {        cfg.ConfigureEndpoints(context);    });    x.AddBasketModuleConsumers();}); The preceding code registers the following: The container we register those dependencies into is also used for and by the modules because the aggregator is the host. Those dependencies are shared across…