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