Exemple #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            SurveyDBContext surveyDBContext,
            QuestionTypeDBContext questionTypeDBContext,
            UserDBContext userDBContext,
            ILoggerFactory loggerFactory
            )
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseCors(x => x
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .AllowCredentials());

            app.UseAuthentication();

            app.UseStaticFiles();

            surveyDBContext.CreateSeedData();

            questionTypeDBContext.CreateSeedData();

            userDBContext.CreateSeedData();

            app.UseHttpsRedirection();

            app.UseMvc();
        }