public void Configure(IApplicationBuilder app, IWebHostEnvironment env, AdmContext admContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseCors(_allowSpecificOrigins); try { Console.WriteLine("Trying to connect to database..."); int retries = 1; while (retries < 7) { try { Console.WriteLine("Connecting to database. Trial: {0}", retries); admContext.Database.MigrateAsync().GetAwaiter().GetResult(); break; } catch { Thread.Sleep((int)Math.Pow(2, retries) * 1000); retries++; } } Console.WriteLine("Database connected successfully."); } catch (Exception e) { Console.WriteLine("An error occurred when trying to connect to database. Error: {}.", e); } var optionsBuilder = new DbContextOptionsBuilder <AdmContext>(); optionsBuilder.UseNpgsql(_admConnectionString); using (var context = new AdmContext(optionsBuilder.Options)) { context.Database.Migrate(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseStaticFiles(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseGraphQLPlayground(new GraphQLPlaygroundOptions()); }
public LoginService(AdmContext context, WodinContext contextAplicacao) { _context = context; _contextAplicacao = contextAplicacao; }
public MenuService(AdmContext context) { _context = context; }
public AdmEmpresasController(AdmContext context) { _context = context; }
public UsuarioPermissaoAcessosController(WodinContext context, AdmContext admContext) { _context = context; this._admContext = admContext; }
public MenusController(AdmContext context, MenuService menuService) { _context = context; _menuService = menuService; }
public UserController(AdmContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public LoginsController(AdmContext context, WodinContext contextAplicacao, LoginService loginService) { _context = context; _contextAplicacao = contextAplicacao; _loginService = loginService; }
public SubMenusController(AdmContext context, SubMenuService submenuService) { _context = context; _submenuService = submenuService; }