Esempio n. 1
0
        // Function to check if the database is populated / needs migrations applied
        public static void EnsurePopulated(IApplicationBuilder application)
        {
            // Get context
            MovieDBContext context = application.ApplicationServices.CreateScope().ServiceProvider.GetRequiredService <MovieDBContext>();


            // Check if migrations need to be applied
            if (context.Database.GetPendingMigrations().Any())
            {
                context.Database.Migrate();
            }
        }
Esempio n. 2
0
 public EFMovieRepo(MovieDBContext context)
 {
     _context = context;
 }