// 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(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseCors(c => c.AllowAnyOrigin().AllowAnyMethod().WithMethods("PATCH").AllowAnyHeader().Build()); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseOpenApi(o => o.DocumentName = "Nococid-Api-Docs"); app.UseAuthentication(); app.UseSwaggerUi3(); IServiceScope serviceScope = app.ApplicationServices.CreateScope(); NococidContext context = serviceScope.ServiceProvider.GetRequiredService <NococidContext>(); new ContextInitialization().Init(context); }
public DatabaseContextsController(NococidContext context) { _context = context; }