first commit -push
This commit is contained in:
17
RobotNet.MapManager/Data/MapManagerDbExtensions.cs
Normal file
17
RobotNet.MapManager/Data/MapManagerDbExtensions.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user