using ApplicationLayer.Applicants; using ApplicationLayer.Locations; using ApplicationLayer.VisaApplications; using Infrastructure.Database; using Infrastructure.Database.Applicants.Repositories; using Infrastructure.Database.Generic; using Infrastructure.Database.Locations.Repositories.Cities; using Infrastructure.Database.Locations.Repositories.Countries; using Infrastructure.Database.VisaApplications.Repositories; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using DbContext = Infrastructure.Database.DbContext; namespace Infrastructure; /// Provides methods to add services to DI-container public static class DependencyInjection { /// Add services needed for Infrastructure layer public static IServiceCollection AddInfrastructure(this IServiceCollection services) { //TODO строка подключения services.AddDbContext(opts => opts.UseSqlServer("Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=visadb;Integrated Security=True;")); services.AddScoped(serviceProvider => serviceProvider.GetRequiredService()); services.AddScoped(serviceProvider => serviceProvider.GetRequiredService()); services.AddScoped(serviceProvider => serviceProvider.GetRequiredService()); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); return services; } }