|
@@ -8,7 +8,7 @@ public class AppServer
|
|
|
{
|
|
{
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
|
- ConfigureServices(builder.Services);
|
|
|
|
|
|
|
+ ConfigureServices(builder.Services, builder.Configuration);
|
|
|
builder.Services.AddControllers();
|
|
builder.Services.AddControllers();
|
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
@@ -32,9 +32,12 @@ public class AppServer
|
|
|
app.Run();
|
|
app.Run();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void ConfigureServices(IServiceCollection services)
|
|
|
|
|
|
|
+ private void ConfigureServices(IServiceCollection services, IConfigurationRoot config)
|
|
|
{
|
|
{
|
|
|
- services.AddSingleton<IDatabase>(new Database());
|
|
|
|
|
|
|
+ services.AddSingleton<IDatabase, Database>();
|
|
|
services.AddScoped<QueryFactory, QueryFactory>();
|
|
services.AddScoped<QueryFactory, QueryFactory>();
|
|
|
|
|
+
|
|
|
|
|
+ services.Configure<PersistenceOptions>(config.GetSection(PersistenceOptions.Persistence));
|
|
|
|
|
+ services.AddTransient<IPersistenceOptions, PersistenceOptionsAccessor>();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|