using FluentValidation; using MediatR; using Microsoft.Extensions.DependencyInjection; using RAG.Application.Auth.Commands; using RAG.Application.Common; using RAG.Infrastructure; using Volo.Abp.Modularity; namespace RAG.Application; /// /// Application 层模块,注册 MediatR 以启用 CQRS 命令/查询处理。 /// [DependsOn(typeof(RAGInfrastructureModule))] public class RAGApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { var services = context.Services; var assembly = typeof(RegisterCommand).Assembly; services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(assembly)); services.AddValidatorsFromAssembly(assembly); services.AddScoped(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>)); } }