using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Configuration; using Microsoft.EntityFrameworkCore; using Knot.Modules.Auth.Infrastructure.Persistence; using Knot.Contracts.Auth.Domain; using Knot.Contracts.Auth.Domain; using Knot.Contracts.Auth.Application.Abstractions; using Knot.Modules.Auth.Infrastructure.Authentication; using Knot.Shared.Kernel; namespace Knot.Modules.Auth; public static class DependencyInjection { /// /// Регистрация сервисов модуля Identity. /// public static IServiceCollection AddAuthModule( this IServiceCollection services, IConfiguration configuration) { // Настройка базы данных string connectionString = configuration.GetConnectionString("DefaultConnection")!; services.AddDbContext(options => options.UseNpgsql(connectionString)); // Регистрация Unit of Work и Репозиториев services.AddScoped(sp => sp.GetRequiredService()); services.AddScoped(sp => sp.GetRequiredService()); services.AddScoped(); services.AddScoped(); services.AddScoped(); // Регистрация MediatR для этого модуля services.AddMediatR(config => config.RegisterServicesFromAssembly(typeof(DependencyInjection).Assembly)); return services; } }