Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }
            using (IServiceScope serviceScope = app.ApplicationServices.CreateScope())
            {
                MasterContext context = serviceScope.ServiceProvider.GetRequiredService <MasterContext>();
                context.Database.Migrate();
            }

            using (DatabaseInit database = new DatabaseInit())
            {
                database.InitializeDb();
            }
            app.UseHttpsRedirection();
            app.UseMvc();
        }