Changed models, added Application layer models

This commit is contained in:
2024-08-15 14:54:23 +03:00
parent 1d8405b4ec
commit c1a4acf414
50 changed files with 628 additions and 647 deletions

View File

@@ -8,28 +8,27 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using DbContext = Infrastructure.Database.DbContext;
namespace Infrastructure
namespace Infrastructure;
/// Provides methods to add services to DI-container
public static class DependencyInjection
{
/// 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)
{
/// Add services needed for Infrastructure layer
public static IServiceCollection AddInfrastructure(this IServiceCollection services)
{
//TODO строка подключения
services.AddDbContext<DbContext>(opts =>
opts.UseSqlServer("Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=visadb;Integrated Security=True;"));
//TODO строка подключения
services.AddDbContext<DbContext>(opts =>
opts.UseSqlServer("Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=visadb;Integrated Security=True;"));
services.AddScoped<IGenericReader>(serviceProvider => serviceProvider.GetRequiredService<DbContext>());
services.AddScoped<IGenericWriter>(serviceProvider => serviceProvider.GetRequiredService<DbContext>());
services.AddScoped<IUnitOfWork>(serviceProvider => serviceProvider.GetRequiredService<DbContext>());
services.AddScoped<IGenericReader>(serviceProvider => serviceProvider.GetRequiredService<DbContext>());
services.AddScoped<IGenericWriter>(serviceProvider => serviceProvider.GetRequiredService<DbContext>());
services.AddScoped<IUnitOfWork>(serviceProvider => serviceProvider.GetRequiredService<DbContext>());
services.AddScoped<IApplicantsRepository, ApplicantsRepository>();
services.AddScoped<IVisaApplicationsRepository, VisaApplicationsRepository>();
services.AddScoped<ICitiesRepository, CitiesRepository>();
services.AddScoped<ICountriesRepository, CountriesRepository>();
services.AddScoped<IApplicantsRepository, ApplicantsRepository>();
services.AddScoped<IVisaApplicationsRepository, VisaApplicationsRepository>();
services.AddScoped<ICitiesRepository, CitiesRepository>();
services.AddScoped<ICountriesRepository, CountriesRepository>();
return services;
}
return services;
}
}
}