コード例 #1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, DashboardModelBuilder modelBuilder)
        {
            using (var scope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                scope.ServiceProvider.GetService <CADContext>().Database.Migrate();
            }
            var serviceProvider = app.ApplicationServices.GetService <IServiceProvider>();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseStatusCodePagesWithReExecute("/Error/{0}");
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseAuthentication();
            app.UseMvc(routeBuilder =>
            {
                routeBuilder.MapODataServiceRoute("ODataRoutes", "odata", modelBuilder.GetEdmModel(app.ApplicationServices));
            });
        }
コード例 #2
0
 public DashboardController()
 {
     _modelBuilder = new DashboardModelBuilder();
 }