// 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) { // Set up of logging mechanism loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); // Use developer exception page for error if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope()) { ProblemSolvingDBContext context = serviceScope.ServiceProvider.GetService <ProblemSolvingDBContext>(); context.Database.EnsureCreated(); bool.TryParse(Configuration.GetSection("PrepareInitialDataDump").Value, out var prepareInitialDataDump); if (prepareInitialDataDump) { SeedTestData(context); } } // Set up angular project routes // Make sure to add angular routes if you add more of them app.Use(async(context, next) => { if (context.Request.Path.HasValue && null != _angularRoutes.FirstOrDefault((ar) => context.Request.Path.Value.StartsWith(ar, StringComparison.OrdinalIgnoreCase))) { context.Request.Path = new PathString("/"); } await next(); }); // force all traffic to use https instead of http // app.UseHsts(opt => // { // opt.MaxAge(days: 720); //Set max age for remembering the HSTS settings (set it to year or so in production) // opt.IncludeSubdomains(); //Include all domains to SSL traffic // opt.Preload(); //Assums that client uses hsts if site is listed under common sites using hsts // }); // Enable access across all origins app.UseCors("AllowAllOrigins"); // Enable access static HTML pages app.UseDefaultFiles(); app.UseStaticFiles(); // Enable server side caching // Will cache response of API which are marked with [ResponseCache(CacheProfileName = "ServerResponseCacheProfile")] app.UseResponseCaching(); // Add MVC to pipeline app.UseMvc(); }
// For i private static void SeedTestData(ProblemSolvingDBContext context) { context.Customers.Add(new CustomerEntity { Id = Guid.NewGuid(), Name = "Ford Livonia", Location = "Fort Mill, SC" }); context.Customers.Add(new CustomerEntity { Id = Guid.NewGuid(), Name = "Ford Charlotte", Location = "Charlotte, NC" }); context.Customers.Add(new CustomerEntity { Id = Guid.NewGuid(), Name = "GM Detriot", Location = "Fort Mill, SC" }); context.Customers.Add(new CustomerEntity { Id = Guid.NewGuid(), Name = "GM Houston", Location = "Houston, TX" }); context.Customers.Add(new CustomerEntity { Id = Guid.NewGuid(), Name = "GM Dallas", Location = "Dallas, TX" }); context.Customers.Add(new CustomerEntity { Id = Guid.NewGuid(), Name = "Honda Santa Clara", Location = "Santa Clara, CA" }); context.SaveChanges(); }
public ComplaintCodeService(ProblemSolvingDBContext dbContext) { _dbContext = dbContext; }
public PlantService(ProblemSolvingDBContext dbContext) { _dbContext = dbContext; }
public DepartmentService(ProblemSolvingDBContext dbContext) { _dbContext = dbContext; }
public CustomerService(ProblemSolvingDBContext dbContext) { _dbContext = dbContext; }
public ProblemSolvingTypeService(ProblemSolvingDBContext dbContext) { _dbContext = dbContext; }