18 lines
565 B
C#
18 lines
565 B
C#
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace RobotNet.RobotManager.Data;
|
|
|
|
public static class RobotManagerDbExtensions
|
|
{
|
|
public static async Task SeedRobotManagerDbAsync(this IServiceProvider serviceProvider)
|
|
{
|
|
using var scope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope();
|
|
|
|
using var appDb = scope.ServiceProvider.GetRequiredService<RobotEditorDbContext>();
|
|
|
|
await appDb.Database.MigrateAsync();
|
|
//await appDb.Database.EnsureCreatedAsync();
|
|
await appDb.SaveChangesAsync();
|
|
}
|
|
}
|