示例#1
0
        // 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();
            }
        }
示例#2
0
 public ExampleController(ExampleDbContext context)
 {
     _context = context;
 }