Skip to content

Commit 6fa2581

Browse files
committed
Tests: disable model cache only if the tests are changing the model
1 parent 0888b1d commit 6fa2581

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/Thinktecture.EntityFrameworkCore.Relational.Tests/IntegrationTestsBase.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ protected override void ConfigureTestDbContextProvider(SqliteTestDbContextProvid
2929
.UseMigrationLogLevel(LogLevel.Warning)
3030
.ConfigureOptions(optionsBuilder => ConfigureOptionsBuilder?.Invoke(optionsBuilder))
3131
.InitializeContext(ctx => ctx.ConfigureModel = ConfigureModel)
32-
.UseContextFactory(options => new DbContextWithSchema(options, Schema))
33-
.DisableModelCache();
32+
.UseContextFactory(options => new DbContextWithSchema(options, Schema));
33+
34+
if (ConfigureModel is not null || Schema is not null)
35+
builder.DisableModelCache();
3436
}
3537

3638
protected DbContextWithSchema CreateContextWithSchema(string schema)

0 commit comments

Comments
 (0)