コード例 #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, climatepiDBContext dbContext)
        {
            //Automatic DB migrations on startup.
            var migrations = dbContext.Database.GetPendingMigrations();

            if (migrations.Count() > 0)
            {
                dbContext.Database.Migrate();
            }


            app.UseBlazorFrameworkFiles();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapRazorPages();
                endpoints.MapControllers();
                endpoints.MapFallbackToFile("index.html");
            });
        }
コード例 #2
0
 public ConditionsController(IConfiguration configuration, climatepiDBContext db)
 {
     _db            = db;
     _configuration = configuration;
 }