25 lines
720 B
C#
25 lines
720 B
C#
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace RobotNet10.NavigationTune.Data;
|
|
|
|
public static class TuningDbExtensions
|
|
{
|
|
extension (IServiceProvider serviceProvider)
|
|
{
|
|
public async Task SeedTuningDbAsync()
|
|
{
|
|
using var scope = serviceProvider.CreateScope();
|
|
|
|
using var appDb = scope.ServiceProvider.GetRequiredService<TuningDbContext>();
|
|
|
|
await appDb.Database.MigrateAsync();
|
|
await appDb.Database.EnsureCreatedAsync();
|
|
await appDb.SaveChangesAsync();
|
|
await DefaultDataSeeder.SeedAsync(appDb);
|
|
|
|
}
|
|
}
|
|
}
|