perf(kpi-history): time-sliced batched purge replaces the single daily mega-DELETE
This commit is contained in:
@@ -87,6 +87,25 @@ public static class SqliteTestHelper
|
||||
return context;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// In-memory SQLite context with EF command interceptors attached — lets a
|
||||
/// test observe the actual SQL a repository emits (e.g. count DELETE statements
|
||||
/// issued by a batched purge).
|
||||
/// </summary>
|
||||
public static ScadaBridgeDbContext CreateInMemoryContext(params IInterceptor[] interceptors)
|
||||
{
|
||||
var options = new DbContextOptionsBuilder<ScadaBridgeDbContext>()
|
||||
.UseSqlite("DataSource=:memory:")
|
||||
.ConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning))
|
||||
.AddInterceptors(interceptors)
|
||||
.Options;
|
||||
|
||||
var context = new SqliteTestDbContext(options);
|
||||
context.Database.OpenConnection();
|
||||
context.Database.EnsureCreated();
|
||||
return context;
|
||||
}
|
||||
|
||||
public static ScadaBridgeDbContext CreateFileContext(string dbPath)
|
||||
{
|
||||
var options = new DbContextOptionsBuilder<ScadaBridgeDbContext>()
|
||||
|
||||
Reference in New Issue
Block a user