// 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()) { var context = serviceScope.ServiceProvider.GetRequiredService <StoreContext>(); SampleDataInitializer.InializeData(context); } } app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "SpyStore Service v1"); //c.RoutePrefix = string.Empty; }); app.UseStaticFiles(); app.UseCors("AllowAll"); // has to go before UseMvc app.UseMvc(); }
protected void ResetTheDatabase() { SampleDataInitializer.InializeData(new StoreContextFactory().CreateDbContext(null)); }