Exemplo n.º 1
0
 public StudentsController(ILoggerManagerService logger, IStudentService studentService, IServiceBusService serviceBusService, IMapper mapper)
 {
     _logger            = logger;
     _studentService    = studentService;
     _serviceBusService = serviceBusService;
     _mapper            = mapper;
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
        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());
                    }
                });
            });
        }
Exemplo n.º 4
0
        // 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();
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 public ExceptionMiddleware(RequestDelegate next, ILoggerManagerService logger)
 {
     _logger = logger;
     _next   = next;
 }
Exemplo n.º 7
0
 public SessionsController(IMapper mapper, ILoggerManagerService logger, ISessionService sessionService)
 {
     _logger         = logger;
     _sessionService = sessionService;
     _mapper         = mapper;
 }