// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); // 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.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); // Enable middleware to serve generated Swagger as a JSON endpoint. // Needs to be after authentication to protect the Swagger UI from anonymous access app.UseSwaggerAuthorized(); app.UseSwagger(); // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), // specifying the Swagger JSON endpoint. app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "API Docs"); }); app.UseSession(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "", pattern: "{controller}/{action}/page/{pagenumber}/size/{pagesize}/sort/{sortfield}/{sortdirection}/filter/{ReportType}/searchString/{SearchString}" ); endpoints.MapAreaControllerRoute( name: "", areaName: "Admin", pattern: "Admin/{controller}/{action}/page/{pagenumber}/size/{pagesize}/sort/{sortfield}/{sortdirection}/filter/{ReportType}/searchString/{SearchString}" ); endpoints.MapAreaControllerRoute( name: "admin", areaName: "Admin", pattern: "Admin/{controller=Home}/{action=Index}/{id?}" ); endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapControllerRoute( name: "search", pattern: "{controller=Home}/{action=Index}/{searchString?}"); }); // Creates the admin role on startup if it doesn't exist, so we can access the admin area for the first time DocSearchContext.CreateAdminRole(app.ApplicationServices).Wait(); }
public Repository(DocSearchContext ctx) { context = ctx; dbset = context.Set <T>(); }
public DocSearchUnitOfWork(DocSearchContext ctx) => context = ctx;