diff --git a/API/FamilyTreeAPI/Program.cs b/API/FamilyTreeAPI/Program.cs index 2c1cbfd..6f41e17 100644 --- a/API/FamilyTreeAPI/Program.cs +++ b/API/FamilyTreeAPI/Program.cs @@ -103,19 +103,7 @@ using (var scope = app.Services.CreateScope()) var db = context.Database; if (db != null) { - try - { - using var cts = new CancellationTokenSource(); - CancellationToken cancellationToken = cts.Token; - await db.MigrateAsync(cancellationToken); - db.EnsureCreated(); - } - catch - { - //continue - } - - var staff = context.GetService(); + var staff = scope.ServiceProvider.GetService(); int id = staff.InsertOneUser(); if (id < 0) { @@ -131,23 +119,17 @@ using (var scope = app.Services.CreateScope()) { //continue } - } id = staff.InsertOneUser(); } - } - - } catch (Exception e) { Console.WriteLine(e.ToString()); } - } - app.UseMiddleware(); // Configure the HTTP request pipeline. //if (app.Environment.IsDevelopment())//