51 lines
2.0 KiB
C#
51 lines
2.0 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using skydiveLogs_api.DomainService.Repositories;
|
|
using skydiveLogs_api.Infrastructure;
|
|
using skydiveLogs_api.DomainBusiness.Interfaces;
|
|
using skydiveLogs_api.DomainBusiness;
|
|
using skydiveLogs_api.Infrastructure.Interfaces;
|
|
|
|
|
|
namespace skydiveLogs_api.Ioc
|
|
{
|
|
public class IocService
|
|
{
|
|
public IocService(IServiceCollection services,
|
|
IConfiguration configuration)
|
|
{
|
|
_services = services;
|
|
_configuration = configuration;
|
|
}
|
|
|
|
public void Configure()
|
|
{
|
|
_services.AddScoped<IAircraftService, AircraftService>();
|
|
_services.AddScoped<IGearService, GearService>();
|
|
_services.AddScoped<IDropZoneService, DropZoneService>();
|
|
_services.AddScoped<IJumpService, JumpService>();
|
|
_services.AddScoped<IJumpTypeService, JumpTypeService>();
|
|
_services.AddScoped<IStatsService, StatsService>();
|
|
_services.AddScoped<IUserService, UserService>();
|
|
_services.AddScoped<IUserImageService, UserImageService>();
|
|
_services.AddScoped<IInitDbService, InitDbService>();
|
|
|
|
_services.AddScoped<IAircraftRepository, AircraftRepository>();
|
|
_services.AddScoped<IDropZoneRepository, DropZoneRepository>();
|
|
_services.AddScoped<IJumpRepository, JumpRepository>();
|
|
_services.AddScoped<IJumpTypeRepository, JumpTypeRepository>();
|
|
_services.AddScoped<IGearRepository, GearRepository>();
|
|
_services.AddScoped<IUserRepository, UserRepository>();
|
|
_services.AddScoped<IUserImageRepository, UserImageRepository>();
|
|
|
|
string connectionString = _configuration.GetConnectionString("DefaultConnection");
|
|
_services.AddSingleton<IDataProvider>(c => new LiteDbProvider(connectionString));
|
|
}
|
|
|
|
private readonly IServiceCollection _services;
|
|
|
|
private readonly IConfiguration _configuration;
|
|
}
|
|
}
|