Пример #1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseSwagger();

            app.UseSwaggerUI(options =>
                             options.SwaggerEndpoint("/swagger/v1/swagger.json", "Conference Planner API v1")
                             );

            app.UseHttpsRedirection();
            app.UseMvc();

            app.Run(context =>
            {
                context.Response.Redirect("/swagger");
                return(Task.CompletedTask);
            });

            if (Configuration["RESET_DB"] != null && Configuration["RESET_DB"] == "1")
            {
                var loader = new DevIntersectionLoader(app.ApplicationServices);
                loader.LoadData("DevIntersection_Vegas_2017.json", "DevIntersection Vegas 2017");
            }
        }
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }

            app.UseSwagger();

            app.UseSwaggerUI(options =>
                             options.SwaggerEndpoint("/swagger/v1/swagger.json", "Conference Planner API v1")
                             );

            app.UseMvc();

            app.Run(context =>
            {
                context.Response.Redirect("/swagger");
                return(Task.CompletedTask);
            });

            // Comment out the following line to avoid resetting the database each time
            var loader = new DevIntersectionLoader(app.ApplicationServices);

            loader.LoadData("DevIntersection_Vegas_2017.json", "DevIntersection Vegas 2017");
        }
Пример #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseSwagger();

            app.UseSwaggerUI(options =>
                             options.SwaggerEndpoint("/swagger/v1/swagger.json", "Conference Planner API v1")
                             );

            app.UseMvc();

            app.Run(context =>
            {
                context.Response.Redirect("/swagger");
                return(Task.CompletedTask);
            });

            // Comment out the following line to avoid resetting the database each time
            var loader = new DevIntersectionLoader(app.ApplicationServices);

            loader.LoadData("DevIntersection_Orlando_2018.json", "DevIntersection Orlando 2018");
        }
Пример #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            InitializeDatabase(app.ApplicationServices);

            app.UseSwagger();

            app.UseSwaggerUI(options =>
                             options.SwaggerEndpoint("/swagger/v1/swagger.json", "Conference Planner API v1")
                             );

            app.UseMvc();

            // Comment out the following line to avoid resetting the database each time
            var loader = new DevIntersectionLoader(app.ApplicationServices);

            loader.LoadData("DevIntersection_Vegas_2017.json", "DevIntersection Vegas 2017");
        }