Skip to content

Commit 4d1262c

Browse files
committed
Small fixes for DatabaseErrorPageMiddleware
The main change here is to also allow public `HasTables` to be found. This will be removed once we get the new EF merged. The change to the migration makes it align with what we would generate, but I don't think has any functional impact on the tests. See also dotnet/efcore#16024 which (I really hope!)fixes the other failures once it makes it here.
1 parent ecd709e commit 4d1262c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Middleware/Diagnostics.EntityFrameworkCore/src/DatabaseErrorPageMiddleware.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public virtual async Task Invoke(HttpContext httpContext)
135135
if (databaseExists)
136136
{
137137
// Also check if the database is completely empty - see https://github.com/aspnet/EntityFrameworkCore/issues/15997
138-
databaseExists = (bool)typeof(RelationalDatabaseCreator).GetMethod("HasTables", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(relationalDatabaseCreator, null);
138+
databaseExists = (bool)typeof(RelationalDatabaseCreator).GetMethod("HasTables", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Invoke(relationalDatabaseCreator, null);
139139
}
140140

141141
var migrationsAssembly = context.GetService<IMigrationsAssembly>();

src/Middleware/Diagnostics.EntityFrameworkCore/test/FunctionalTests/TestModels/BloggingContextWithMigrations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected override void BuildModel(ModelBuilder builder)
2828
{
2929
builder.Entity("Blogging.Models.Blog", b =>
3030
{
31-
b.Property<int>("BlogId");
31+
b.Property<int>("BlogId").ValueGeneratedOnAdd();
3232
b.Property<string>("Name");
3333
b.HasKey("BlogId");
3434
});

0 commit comments

Comments
 (0)