protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { Console.WriteLine("OnConfiguring"); var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); if (environment == "Testing") { optionsBuilder.UseInMemoryDatabase(databaseName: "TestInMemoryEfDatabase"); return; } var connectionString = _secretManager.GetConnectionString().Result; Console.WriteLine($"Try connect to: {connectionString}"); optionsBuilder.UseNpgsql(connectionString); }