Update DatabaseErrorPageMiddleware to use HasTables

This commit is contained in:
Arthur Vickers 2019-06-18 15:18:39 -07:00
parent 9ea20ddef3
commit 730c3e0053
1 changed files with 1 additions and 3 deletions

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
@ -134,8 +133,7 @@ namespace Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
if (databaseExists)
{
// Also check if the database is completely empty - see https://github.com/aspnet/EntityFrameworkCore/issues/15997
databaseExists = (bool)typeof(RelationalDatabaseCreator).GetMethod("HasTables", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Invoke(relationalDatabaseCreator, null);
databaseExists = await relationalDatabaseCreator.HasTablesAsync();
}
var migrationsAssembly = context.GetService<IMigrationsAssembly>();