diff --git a/src/Middleware/Diagnostics.EntityFrameworkCore/src/DatabaseErrorPageMiddleware.cs b/src/Middleware/Diagnostics.EntityFrameworkCore/src/DatabaseErrorPageMiddleware.cs index 96ebb8a1f4cc..acbc43ae1d56 100644 --- a/src/Middleware/Diagnostics.EntityFrameworkCore/src/DatabaseErrorPageMiddleware.cs +++ b/src/Middleware/Diagnostics.EntityFrameworkCore/src/DatabaseErrorPageMiddleware.cs @@ -135,7 +135,7 @@ public virtual async Task Invoke(HttpContext httpContext) 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).Invoke(relationalDatabaseCreator, null); + databaseExists = (bool)typeof(RelationalDatabaseCreator).GetMethod("HasTables", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Invoke(relationalDatabaseCreator, null); } var migrationsAssembly = context.GetService(); diff --git a/src/Middleware/Diagnostics.EntityFrameworkCore/test/FunctionalTests/TestModels/BloggingContextWithMigrations.cs b/src/Middleware/Diagnostics.EntityFrameworkCore/test/FunctionalTests/TestModels/BloggingContextWithMigrations.cs index 1f3204157a09..f4ee82c93895 100644 --- a/src/Middleware/Diagnostics.EntityFrameworkCore/test/FunctionalTests/TestModels/BloggingContextWithMigrations.cs +++ b/src/Middleware/Diagnostics.EntityFrameworkCore/test/FunctionalTests/TestModels/BloggingContextWithMigrations.cs @@ -28,7 +28,7 @@ protected override void BuildModel(ModelBuilder builder) { builder.Entity("Blogging.Models.Blog", b => { - b.Property("BlogId"); + b.Property("BlogId").ValueGeneratedOnAdd(); b.Property("Name"); b.HasKey("BlogId"); });