// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, EbooksContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); // On production execute migrations manually (Script-Migration). context.Database.Migrate(); } app.UseCors(x => x .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public EbookRepository(EbooksContext context) { _context = context; }