|
|
@ -14,7 +14,7 @@ using StubAPI;
|
|
|
|
using StubbedContextLib;
|
|
|
|
using StubbedContextLib;
|
|
|
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
|
|
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
|
|
|
|
|
|
|
|
|
|
|
namespace HeartTrackAPI.Utils;
|
|
|
|
namespace HeartTrackAPI;
|
|
|
|
public class AppBootstrap(IConfiguration configuration)
|
|
|
|
public class AppBootstrap(IConfiguration configuration)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private IConfiguration Configuration { get; } = configuration;
|
|
|
|
private IConfiguration Configuration { get; } = configuration;
|
|
|
@ -80,7 +80,12 @@ public class AppBootstrap(IConfiguration configuration)
|
|
|
|
switch (Environment.GetEnvironmentVariable("TYPE"))
|
|
|
|
switch (Environment.GetEnvironmentVariable("TYPE"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case "BDD":
|
|
|
|
case "BDD":
|
|
|
|
services.AddSingleton<IDataManager>(provider => new DbDataManager(provider.GetRequiredService<HeartTrackContext>()));
|
|
|
|
// services.AddSingleton<IDataManager>(provider => new DbDataManager(provider.GetRequiredService<HeartTrackContext>()));
|
|
|
|
|
|
|
|
services.AddSingleton<IDataManager>(provider =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
provider.GetRequiredService<TrainingStubbedContext>().Database.EnsureCreated();
|
|
|
|
|
|
|
|
return new DbDataManager(provider.GetRequiredService<HeartTrackContext>());
|
|
|
|
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "STUB-MODEL":
|
|
|
|
case "STUB-MODEL":
|
|
|
|
services.AddSingleton<IDataManager, StubData>();
|
|
|
|
services.AddSingleton<IDataManager, StubData>();
|
|
|
|