public static void EnsurePopulated(IApplicationBuilder application) { FilmListDbContext context = application.ApplicationServices.CreateScope().ServiceProvider. GetRequiredService <FilmListDbContext>(); if (context.Database.GetPendingMigrations().Any()) { context.Database.Migrate(); } if (!context.FilmInfo.Any()) { context.FilmInfo.AddRange( new FilmInfo { } ); } }
public EFFilmListRepository(FilmListDbContext context) { _context = context; }