// 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();

                using (var serviceScope = app.ApplicationServices
                                          .GetRequiredService <IServiceScopeFactory>()
                                          .CreateScope())
                {
                    try
                    {
                        var context = serviceScope.ServiceProvider.GetService <DatabaseContext>();
                        SampleDataInitializer.Initialize(context);
                    }
                    catch (Exception ex)
                    {
                        var logger = serviceScope.ServiceProvider.GetService <ILogger <Startup> >();
                        logger.LogError(ex, "An error occurred while seeding the database.");
                    }
                }
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseGraphQL <BlogSchema>();
            app.UseGraphQLPlayground(options: new GraphQLPlaygroundOptions());

            app.UseHttpsRedirection();
            app.UseMvc();
        }
 public static void SeedDatabase(IHostingEnvironment hostingEnvironment,
                                 AspergillosisContext context)
 {
     SampleDataInitializer.Initialize(context);
     SampleDataInitializer.AddDefaultPatientStatuses(context);
     SampleDataInitializer.CreateDbImportTypes(context);
     SampleDataInitializer.AddIgTypes(context);
     RadiologyDataInitializer.AddRadiologyModels(context);
     CaseReportFormsDataInitializer.AddCaseReportFormsModels(context);
     QoLExcelImportType.Seed(context);
     IGgEPRImportTypeSeed.Seed(context);
     CaseReportFormsDataInitializer.AddSelectFieldTypes(context);
     MedicalTiralsDataInitializer.AddMedicalTrialsModels(context);
     IntraDrugLevelExcelTypeSeed.Seed(context);
     UnitOfMeasureMgLSeed.Seed(context);
     ManArtsImportSeed.Seed(context);
     ManArtsImportSeed.AddOtherPFTs(context);
     ManArtsProcessedFileSeed.Seed(context);
     ManArtsProcessedFileSeed.SeedSmokingStatuses(context);
     ManArtsProcessedFileSeed.SeedDrugLevel(context);
     ManArtsProcessedFileSeed.SeedPFTandHaematology(context);
     EPRClinicLetterDbImportTypeSeed.Seed(context);
     FoodDatabaseSeed.SeedDefaultFoods(context);
     OtherAllergicItemDatabaseSeed.SeedDefaultItems(context);
     FungiAllergicItemDatabaseSeed.SeedDefaultItems(context);
     ReportTypeSeed.Initialize(context);
     DLNACDatesImportTypeSeed.Seed(context);
     EPRTotalIgEImportTypeSeed.Seed(context);
     UnitOfMeasureMgLSeed.SeedOtherUnits(context);
     TestTypeSeed.Seed(context);
     PatientTestsResultsImportTypeSeed.CRPSeed(context);
     PatientTestsResultsImportTypeSeed.AlbuminSeed(context);
     PatientTestsResultsImportTypeSeed.HbSeed(context);
     PatientTestsResultsImportTypeSeed.WBCSeed(context);
     PatientTestsResultsImportTypeSeed.LymphocytesSeed(context);
     QoLExcelImportType.SeedMRC(context);
     ReportTypeSeed.AddCPAMortalityAudit(context);
     ReportTypeSeed.AddIgGAndSGRQReport(context);
     AllTestTypesSeed.Seed(context);
     RadiologyDataInitializer.OtherRadiologyTypes(context, hostingEnvironment);
     PFTSpreadsheetImproterTypeSeed.Seed(context);
     ReferallDatesImportTypeSeed.Run(context);
     AddHospitalAdmissionDbImportType.Seed(context);
     DateOfDiagnosisDbImportType.Seed(context);
     AddMortalityAuditDates.Seed(context);
     AddMortalityAuditSGRQ.Seed(context);
     AddMortalityAuditMRCScore.Seed(context);
     AddMortalityAuditWeightAndHeight.Seed(context);
     //PostcodeSeed.ReadCsvIntoDatabase(hostingEnvironment, context);
 }