public StudentsController(ILoggerManagerService logger, IStudentService studentService, IServiceBusService serviceBusService, IMapper mapper) { _logger = logger; _studentService = studentService; _serviceBusService = serviceBusService; _mapper = mapper; }
public CoursesController(ICoursesService coursesService, IStudentService studentService, IServiceBusService serviceBusService, IStudentSessionService studentSessionService, IMapper mapper, ILoggerManagerService logger) { _coursesService = coursesService; _studentService = studentService; _serviceBusService = serviceBusService; _serviceBusService = serviceBusService; _studentSessionService = studentSessionService; _logger = logger; _mapper = mapper; }
public static void ConfigureExceptionHandler(this IApplicationBuilder app, ILoggerManagerService logger) { app.UseExceptionHandler(appError => { appError.Run(async context => { context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; context.Response.ContentType = "application/json"; var contextFeature = context.Features.Get <IExceptionHandlerFeature>(); if (contextFeature != null) { logger.LogError($"Something went wrong: {contextFeature.Error}"); await context.Response.WriteAsync(new ErrorDetails() { StatusCode = context.Response.StatusCode, Message = "Internal Server Error." }.ToString()); } }); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerManagerService logger) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // 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.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Course Sign-up API V1"); }); app.ConfigureCustomExceptionMiddleware(); app.UseHttpsRedirection(); app.UseMvc(); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerManagerService logger, IOptionsMonitor <GESREPConfig> GESREPConfigAccessor) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("./swagger/v1/swagger.json", "Identity API V1"); c.RoutePrefix = string.Empty; }); app.ConfigureCustomExceptionMiddleware(); app.UseSerilogRequestLogging(); app.UseCors("CorsPolicy"); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseGESREPProxy(GESREPConfigAccessor.CurrentValue); }
public ExceptionMiddleware(RequestDelegate next, ILoggerManagerService logger) { _logger = logger; _next = next; }
public SessionsController(IMapper mapper, ILoggerManagerService logger, ISessionService sessionService) { _logger = logger; _sessionService = sessionService; _mapper = mapper; }