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;
|
var db = context.Database;
|
||||||
if (db != null)
|
if (db != null)
|
||||||
{
|
{
|
||||||
try
|
var staff = scope.ServiceProvider.GetService<Seed>();
|
||||||
{
|
|
||||||
using var cts = new CancellationTokenSource();
|
|
||||||
CancellationToken cancellationToken = cts.Token;
|
|
||||||
await db.MigrateAsync(cancellationToken);
|
|
||||||
db.EnsureCreated();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
//continue
|
|
||||||
}
|
|
||||||
|
|
||||||
var staff = context.GetService<Seed>();
|
|
||||||
int id = staff.InsertOneUser();
|
int id = staff.InsertOneUser();
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
{
|
{
|
||||||
@@ -131,23 +119,17 @@ using (var scope = app.Services.CreateScope())
|
|||||||
{
|
{
|
||||||
//continue
|
//continue
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
id = staff.InsertOneUser();
|
id = staff.InsertOneUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e.ToString());
|
Console.WriteLine(e.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
app.UseMiddleware<JwtMiddleware>();
|
app.UseMiddleware<JwtMiddleware>();
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
//if (app.Environment.IsDevelopment())//
|
//if (app.Environment.IsDevelopment())//
|
||||||
|
|||||||
Reference in New Issue
Block a user