remove ensure mirgration
and scope.serviceProvider.getService
This commit is contained in:
@@ -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())//
|
||||
|
||||
Reference in New Issue
Block a user