// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); using (var context = new ExampleDbContext(loggerFactory, Configuration.GetSection("ConnectionStrings"))) { context.Database.Migrate(); } }
public ExampleController(ExampleDbContext context) { _context = context; }