using MediatR; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Nashel.BuildingBlocks.Application.Abstractions; using Nashel.BuildingBlocks.Application.Behaviors; using Nashel.Modules.Identity.Application.Commands; using Nashel.Modules.Identity.Domain.Repositories; using Nashel.Modules.Identity.Domain.Services; using Nashel.Modules.Identity.Infrastructure.Persistence; using Nashel.Modules.Identity.Infrastructure.Repositories; using Nashel.Modules.Identity.Infrastructure.Services; namespace Nashel.Modules.Identity.Infrastructure; public static class DependencyInjection { public static IServiceCollection AddIdentityModule(this IServiceCollection services, IConfiguration configuration) { services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddHttpContextAccessor(); services.AddMediatR(cfg => { cfg.RegisterServicesFromAssembly(typeof(RegisterUserCommand).Assembly); cfg.AddBehavior(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>)); }); services.AddDbContext(options => { options.UseNpgsql(configuration.GetConnectionString("DefaultConnection")); }); return services; } }