using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Configuration; using MTWorkHR.Infrastructure.EmailService; using MTWorkHR.Infrastructure.Logging; 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; using MTWorkHR.Core.Email; 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(IProjectRepository), typeof(ProjectRepository)); services.AddScoped(typeof(ITaskStatusRepository), typeof(TaskStatusRepository)); services.AddScoped(typeof(IUserTaskRepository), typeof(UserTaskRepository)); services.AddScoped(typeof(IUserTaskHistoryRepository), typeof(UserTaskHistoryRepository)); services.AddScoped(typeof(IPermissionRepository), typeof(PermissionRepository)); services.AddScoped(typeof(IRolePermissionRepository), typeof(RolePermissionRepository)); services.AddScoped(typeof(IUserRoleRepository>), typeof(UserRoleRepository)); services.AddScoped(); services.AddScoped(); services.AddTransient(); services.AddScoped(); services.AddScoped(); services.AddScoped(); //services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>)); return services; } } }