public static void EnsurePopulated(IApplicationBuilder application) { MovieDBContext context = application.ApplicationServices.CreateScope().ServiceProvider.GetRequiredService <MovieDBContext>(); if (context.Database.GetPendingMigrations().Any()) { context.Database.Migrate(); } if (!context.Entries.Any()) { context.Entries.AddRange( new EntryResponse { Category = "Seed", Title = "Seed Data", Year = 1997, Director = "Rachel Morey", Rating = "G", Edited = false, LentTo = "Seed Data", Notes = "Seed Data" }); context.SaveChanges(); } }
public EFMovieRepository(MovieDBContext context) { _context = context; }