Update IoC and the "GET" function in the repository (lock issue)
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace skydiveLogs_api.Ioc
|
||||
{
|
||||
public class IocService
|
||||
{
|
||||
public IocService(IServiceCollection services)
|
||||
public IocService(IServiceCollection services,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
_services = services;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public void Configure()
|
||||
@@ -28,9 +31,12 @@ namespace skydiveLogs_api.Ioc
|
||||
_services.AddScoped<Data.Interface.IJumpTypeRepository, Data.JumpTypeRepository>();
|
||||
_services.AddScoped<Data.Interface.IGearRepository, Data.GearRepository>();
|
||||
|
||||
_services.AddScoped<Data.Interface.IDataProvider, Data.LiteDbProvider>();
|
||||
string connectionString = _configuration.GetConnectionString("DefaultConnection");
|
||||
_services.AddScoped<Data.Interface.IDataProvider>(c => new Data.LiteDbProvider(connectionString));
|
||||
}
|
||||
|
||||
private readonly IServiceCollection _services;
|
||||
|
||||
private readonly IConfiguration _configuration;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user