// 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 (IServiceScope scope = app.ApplicationServices.CreateScope()) { WebShopAppContext ctx = scope.ServiceProvider.GetService <WebShopAppContext>(); DBInitializer.SeedDB(ctx); } } else { using (var scope = app.ApplicationServices.CreateScope()) { var ctx = scope.ServiceProvider.GetService <WebShopAppContext>(); ctx.Database.EnsureCreated(); } app.UseHsts(); } //app.UseCors("AllowSpecificOrigin"); app.UseCors("AllowAnyOrigin"); app.UseHttpsRedirection(); app.UseMvc(); }
public ProductRepository(WebShopAppContext ctx) { _ctx = ctx; }
public OrderRepository(WebShopAppContext ctx) { _ctx = ctx; }