public AccountController(UserManager <AppUser> userManager, ITokenLogService tokenLogService, ICompanyService companyService, IJwtFactory jwtFactory, SignInManager <AppUser> signInManager, IEmailSender emailSender, IConfiguration configuration, RoleManager <IdentityRole> roleManager, IOptions <JwtIssuerOptions> jwtOptions, IOptions <FacebookAuthSettings> fbAuthSettingsAccessor, IHostingEnvironment environment, ImpressoDbContext appDbContext) { _userManager = userManager; _jwtFactory = jwtFactory; _signInManager = signInManager; _emailSender = emailSender; _configuration = configuration; _roleManager = roleManager; _fbAuthSettings = fbAuthSettingsAccessor.Value; _jwtOptions = jwtOptions.Value; _hostingEnvironment = environment; _appDbContext = appDbContext; _companyService = companyService; _tokenLogService = tokenLogService; }
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { if (formatter != null && exception != null) { lock (_lock) { // TODO: Move it to serivces DbContextOptionsBuilder <ImpressoDbContext> builder = new DbContextOptionsBuilder <ImpressoDbContext>(); builder.UseMySql(_configuration["Data:ConnectionString"]); using (ImpressoDbContext context = new ImpressoDbContext(builder.Options)) { context.Loggs.Add(new Log() { Message = formatter(state, exception), ExceptionMessage = exception.Message, InnerExceptionMessage = exception.InnerException is null ? "" : exception.InnerException.Message, StackTrace = exception.StackTrace is null ? "" : exception.StackTrace, Date = DateTime.Now });
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env) { loggerFactory.AddDataBase(Configuration); if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseAuthentication(); app.UseSwaggerDocumentation(); app.UseMiddleware(typeof(ErrorHandlingMiddleware)); app.UseMvc(routing => { routing.MapRoute("api", "api/{controller}/{action}/{id?}"); }); app.UseStatusCodePagesWithRedirects("~/Errors/AppError{0}"); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Feeds}/{action=People}"); }); ImpressoDbContext.CreateAppUserAccount(app.ApplicationServices, Configuration, "Data:AdminUser").Wait(); ImpressoDbContext.CreateAppUserAccount(app.ApplicationServices, Configuration, "Data:User").Wait(); ImpressoDbContext.CreateAppUserAccount(app.ApplicationServices, Configuration, "Data:HiringManager").Wait(); }
public UnitOfWork(ImpressoDbContext context) { _context = context; }