Skip to content

Commit c7cc6eb

Browse files
committed
React to EF changes
1 parent 5d87bed commit c7cc6eb

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

src/Middleware/Diagnostics.EntityFrameworkCore/src/HttpContextDatabaseContextDetailsExtensions.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ internal static class HttpContextDatabaseContextDetailsExtensions
4545

4646
var snapshotModel = migrationsAssembly.ModelSnapshot?.Model;
4747

48-
if (snapshotModel is IMutableModel mutableModel)
49-
{
50-
snapshotModel = mutableModel.FinalizeModel();
51-
}
52-
5348
if (snapshotModel != null)
5449
{
5550
snapshotModel = context.GetService<IModelRuntimeInitializer>().Initialize(snapshotModel);

src/Middleware/Diagnostics.EntityFrameworkCore/test/FunctionalTests/DatabaseErrorPageMiddlewareTest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using Microsoft.Extensions.DependencyInjection;
1616
using Microsoft.Extensions.Hosting;
1717
using Microsoft.Extensions.Logging;
18+
using Microsoft.EntityFrameworkCore.Diagnostics;
1819

1920
namespace Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Tests;
2021

@@ -538,7 +539,9 @@ private static async Task<IHost> SetupServer<TContext, TMiddleware>(SqlTestStore
538539
})
539540
.ConfigureServices(services =>
540541
{
541-
services.AddDbContext<TContext>(optionsBuilder => optionsBuilder.UseSqlite(database.ConnectionString));
542+
services.AddDbContext<TContext>(optionsBuilder => optionsBuilder
543+
.UseSqlite(database.ConnectionString)
544+
.ConfigureWarnings(w => w.Log(RelationalEventId.PendingModelChangesWarning)));
542545
});
543546
}).Build();
544547

src/Middleware/Diagnostics.EntityFrameworkCore/test/FunctionalTests/MigrationsEndPointMiddlewareTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public async Task Exception_while_applying_migrations()
262262
await server.CreateClient().PostAsync("http://localhost" + MigrationsEndPointOptions.DefaultPath, formData));
263263

264264
Assert.StartsWith(StringsHelpers.GetResourceString("FormatMigrationsEndPointMiddleware_Exception", typeof(BloggingContextWithSnapshotThatThrows)), ex.Message);
265-
Assert.Equal("Welcome to the invalid migration!", ex.InnerException.Message);
265+
Assert.Equal("Welcome to the invalid snapshot!", ex.InnerException.Message);
266266
}
267267
}
268268
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ private static void BuildSnapshotModel(ModelBuilder builder)
2626
b.Property<int>("BlogId").ValueGeneratedOnAdd();
2727
b.Property<string>("Name");
2828
b.HasKey("BlogId");
29+
b.ToTable("Blogs");
2930
});
3031
}
3132

0 commit comments

Comments
 (0)