From bb6be61cc4458d938c9a87f200382d7cd2170a13 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sat, 20 Nov 2021 14:20:32 -0600 Subject: [PATCH] =?UTF-8?q?refactor(dir):=20=E2=99=BB=F0=9F=9A=A7=20commen?= =?UTF-8?q?t=20npgsql=20reload=20types=20throwing=20disposed=20exception?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Persistence/SeedExtensions.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/services/Directory/FilterLists.Directory.Infrastructure/Persistence/SeedExtensions.cs b/services/Directory/FilterLists.Directory.Infrastructure/Persistence/SeedExtensions.cs index 0f5c5eb0c..2749e736a 100644 --- a/services/Directory/FilterLists.Directory.Infrastructure/Persistence/SeedExtensions.cs +++ b/services/Directory/FilterLists.Directory.Infrastructure/Persistence/SeedExtensions.cs @@ -16,9 +16,11 @@ public static async Task MigrateAsync(this IHost host) using var scope = host.Services.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); await db.Database.MigrateAsync(); - await using var conn = (NpgsqlConnection)db.Database.GetDbConnection(); - await conn.OpenAsync(); - conn.ReloadTypes(); + + // TODO: sometimes throws System.ObjectDisposedException, but sometimes needed for https://www.npgsql.org/efcore/mapping/enum.html#creating-your-database-enum + //await using var conn = (NpgsqlConnection)db.Database.GetDbConnection(); + //await conn.OpenAsync(); + //conn.ReloadTypes(); } }