remove ensure mirgration

and scope.serviceProvider.getService
This commit is contained in:
2026-05-10 21:49:38 +10:00
parent 4c19ec3e6a
commit 936094a4bf
+1 -19
View File
@@ -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<Seed>();
var staff = scope.ServiceProvider.GetService<Seed>();
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<JwtMiddleware>();
// Configure the HTTP request pipeline.
//if (app.Environment.IsDevelopment())//