public override void ResolveRequest(HttpListenerContext context) { #if (IN_MEMORY_DB) using (Context = new CodeRunnerEntities(connection)) { Next.ResolveRequest(context); } #else using (Context = new CodeRunnerEntities()) { Next.ResolveRequest(context); } #endif }
static DBMiddleware() { using (Context = new CodeRunnerEntities(connection)) { var adminUser = new User { Id = Guid.NewGuid(), Email = "*****@*****.**", PasswordHash = Encoding.ASCII.GetBytes(BCrypt.Net.BCrypt.HashPassword("admin1", 12)), Username = "******" }; Context.Users.Add(adminUser); Context.SaveChanges(); } }