// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { using (IServiceScope serviceScope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope()) { MemoryDatabaseContext context = serviceScope.ServiceProvider.GetRequiredService <MemoryDatabaseContext>(); Queries db_queries = new Queries(context); DatabaseInitializer db_init = new DatabaseInitializer(db_queries); db_init.InitializeIngredients(); } if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // 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.UseHttpsRedirection(); app.UseStaticFiles(); if (!env.IsDevelopment()) { app.UseSpaStaticFiles(); } app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); }); // Register the Swagger generator and the Swagger UI middlewares app.UseOpenApi(); app.UseSwaggerUi3(); app.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseAngularCliServer(npmScript: "start"); } }); }
public ClientHub( TunnelRContext database, MemoryDatabaseContext memoryDatabase, UserManager <TunnelRUser> userManager, IMapper mapper, IGamePacketEvaluator packetEvaluator ) { _database = database; _memoryDatabase = memoryDatabase; _userManager = userManager; _mapper = mapper; _packetEvaluator = packetEvaluator; }
public SamplesController(MemoryDatabaseContext context) { _context = context; //Load from Files? if (_context.Samples.Count() == 0) { #region Linx Loading context.LoadStatuses(System.IO.File.ReadAllLines("./Data/Statuses.txt")); context.LoadUsers(System.IO.File.ReadAllLines("./Data/Users.txt")); context.LoadSamples(System.IO.File.ReadAllLines("./Data/Samples.txt")); #endregion #region Windows Loading /* * context.LoadStatuses(System.IO.File.ReadAllLines(".\\Data\\Statuses.txt")); * context.LoadUsers(System.IO.File.ReadAllLines(".\\Data\\Users.txt")); * context.LoadSamples(System.IO.File.ReadAllLines(".\\Data\\Samples.txt")); */ #endregion } }
public Queries(MemoryDatabaseContext dbContext) { _dbContext = dbContext; }
public PizzaController(ILogger <PizzaController> logger, MemoryDatabaseContext dbContext, IMapper mapper) { _mapper = mapper; _dbQueries = new Queries(dbContext); _logger = logger; }
public RoomPacket(MemoryDatabaseContext memoryContext, UserManager <TunnelRUser> userManager) { _memoryContext = memoryContext; _userManager = userManager; }