using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Configuration; using MTWorkHR.Application.Models.Email; using MTWorkHR.Infrastructure.EmailService; using MTWorkHR.Application.Logging; using MTWorkHR.Infrastructure.Logging; using MTWorkHR.Application.Services; using MTWorkHR.Core.Global; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using MTWorkHR.Core.IRepositories.Base; using MTWorkHR.Core.IRepositories; using MTWorkHR.Core.UnitOfWork; using MTWorkHR.Identity.Entities; using MTWorkHR.Infrastructure.Data; using MTWorkHR.Infrastructure.Repositories; using MTWorkHR.Infrastructure.UnitOfWorks; namespace MTWorkHR.Infrastructure { public static class InfrastructureServiceRegistration { public static IServiceCollection AddInfrastructureServices (this IServiceCollection services, AppSettingsConfiguration configuration){ services.AddDbContext(options => { options.UseSqlServer(configuration.ConnectionStrings.MTWorkHRConnectionString); }); services.AddScoped(typeof(IRepository<>), typeof(Repository<>)); services.AddScoped(typeof(IRepositoryLog<>), typeof(RepositoryLog<>)); services.AddScoped(typeof(ICompanyRepository), typeof(CompanyRepository)); services.AddScoped(typeof(IPermissionRepository), typeof(PermissionRepository)); services.AddScoped(typeof(IRolePermissionRepository), typeof(RolePermissionRepository)); services.AddScoped(typeof(IUserRoleRepository>), typeof(UserRoleRepository)); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddTransient(); services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>)); return services; } } }