Skip to content

Commit

Permalink
Small fixes for DatabaseErrorPageMiddleware
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ajcvickers committed Jun 10, 2019
1 parent ecd709e commit 4d1262c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<IMigrationsAssembly>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected override void BuildModel(ModelBuilder builder)
{
builder.Entity("Blogging.Models.Blog", b =>
{
b.Property<int>("BlogId");
b.Property<int>("BlogId").ValueGeneratedOnAdd();
b.Property<string>("Name");
b.HasKey("BlogId");
});
Expand Down

0 comments on commit 4d1262c

Please sign in to comment.