public void Configure(IApplicationBuilder app, IHostingEnvironment env, CRUDAppContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseAuthentication();

            context.Database.Migrate();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Team}/{action=Index}/{id?}");
            });
        }
 public async Task Invoke(HttpContext httpContext)
 {
     using (var serviceScope = httpContext.RequestServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
     {
         using (CRUDAppContext crudAppContext = serviceScope.ServiceProvider.GetService <CRUDAppContext>())
         {
             crudAppContext.Database.Migrate();
         }
     }
     await _next(httpContext); // calling next middleware
 }
Beispiel #3
0
 public InternsController(CRUDAppContext context)
 {
     _context = context;
 }
Beispiel #4
0
 public DepartmentsController(CRUDAppContext context)
 {
     _context = context;
 }