Weasel 8.13.0
What's New
EF Core Batch Queries
New BatchedQuery API combines multiple IQueryable<T> queries into a single database round trip using ADO.NET's DbBatch. Supports PostgreSQL, SQL Server, and SQLite.
await using var batch = context.CreateBatchQuery();
var users = batch.Query(context.Users.Where(u => u.IsActive));
var orders = batch.Query(context.Orders.Where(o => o.Total > 100));
await batch.ExecuteAsync(); // single round tripSQL is extracted via EF Core's stable CreateDbCommand() API. Results materialized using IEntityType metadata with value converter support.
EF Core Database Reset & IInitialData
New IDatabaseCleaner<TContext> for FK-aware database cleanup in integration testing, inspired by Respawn and Marten's ResetAllData().
services.AddDatabaseCleaner<AppDbContext>();
services.AddInitialData<AppDbContext, TestSeedData>();
var cleaner = host.Services.GetRequiredService<IDatabaseCleaner<AppDbContext>>();
await cleaner.ResetAllDataAsync(); // delete all + run seeders- Memoizes table graph and SQL on first use for fast repeated calls
- Multi-tenant support via explicit
DbConnectionoverloads - Provider-specific SQL: PostgreSQL
TRUNCATE CASCADE, SQL ServerDELETE FROM+DBCC CHECKIDENT, SQLiteDELETE FROM+ sqlite_sequence
New Migrator.GenerateDeleteAllSql() Abstract Method
All 5 provider migrators implement provider-specific bulk delete SQL generation. Used by the new DatabaseCleaner.
Bug Fixes
- Fix PK migration with referencing FKs (#45) — When a primary key is dropped and recreated, foreign keys from other tables that reference it are now properly recreated after the PK change
- Fix deadlock in
ManagedListPartitions.InitializeAsync— Double-check locking moved inside semaphore try block (credit: @netijoe via #181) - Fix culture-invariant SQL identifier casing — Replace
ToLower()/ToUpper()with invariant equivalents
Dependency Upgrades
- JasperFx 1.21.4 → 1.24.0