예제 #1
0
        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
                {
                }

                    );
            }
        }
예제 #2
0
 public EFFilmListRepository(FilmListDbContext context)
 {
     _context = context;
 }