RobotNet/RobotNet.ScriptManager/Data/ScriptManagerDbExtensions.cs
2025-10-15 15:15:53 +07:00

18 lines
570 B
C#

using Microsoft.EntityFrameworkCore;
namespace RobotNet.ScriptManager.Data;
public static class ScriptManagerDbExtensions
{
public static async Task SeedScriptManagerDbAsync(this IServiceProvider serviceProvider)
{
using var scope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope();
using var appDb = scope.ServiceProvider.GetRequiredService<ScriptManagerDbContext>();
await appDb.Database.MigrateAsync();
//await appDb.Database.EnsureCreatedAsync();
await appDb.SaveChangesAsync();
}
}