using Microsoft.Extensions.DependencyInjection; namespace {{ProjectName}}.Application; /// /// Dependency injection configuration for client Application layer. /// public static class DependencyInjection { /// /// Adds client-specific application services to the DI container. /// /// IMPORTANT: This must be called AFTER AddSmartStackApplication() /// to ensure all Core services are available. /// public static IServiceCollection Add{{ProjectName}}Application( this IServiceCollection services) { // The platform's AddSmartStack() scans ONLY its own assembly for MediatR // handlers and validators — the CLIENT Application assembly is never // scanned by it. The block below registers this assembly's handlers and // validators; RegisterServicesFromAssembly on a second assembly is // additive (pipeline behaviors stay registered once by the platform). // scaffold-business keeps the block in sync (idempotent markers). // <<< CLIENT-APPLICATION-ASSEMBLY-DI BEGIN >>> services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(typeof(DependencyInjection).Assembly)); services.AddValidatorsFromAssembly(typeof(DependencyInjection).Assembly); // <<< CLIENT-APPLICATION-ASSEMBLY-DI END >>> return services; } }