CI - EnsureCreated in create service
continuous-integration/drone/push Build is passing Details

pull/10/head
David D'ALMEIDA 1 year ago
parent f3a2c23166
commit 62d33ab922

@ -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>();

Loading…
Cancel
Save