1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- 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<HRDataContext>(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<RolePermission>), typeof(RolePermissionRepository));
- services.AddScoped(typeof(IUserRoleRepository<IdentityUserRole<string>>), typeof(UserRoleRepository));
- services.AddScoped<IUnitOfWork, UnitOfWork>();
- services.AddScoped<IUnitOfWorkLog, UnitOfWorkLog>();
- services.AddScoped<ApplicationUserManager>();
- services.AddScoped<GlobalInfo>();
- services.AddScoped<IEmployeeRepository, EmployeeRepository>();
- services.AddTransient<IEmailSender, EmailSender>();
- services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>));
- return services;
- }
- }
- }
|