EF Core dev-time improvements (GH-2539)#2543
Merged
jeremydmiller merged 1 commit intomainfrom Apr 20, 2026
Merged
Conversation
Makes the EF Core dev-loop faster and more discoverable:
- Auto-register Weasel's DatabaseCleaner<> (open generic) inside
UseEntityFrameworkCoreTransactions(). Callers no longer need a
per-context services.AddDatabaseCleaner<T>() — resolving
IDatabaseCleaner<T> / DatabaseCleaner<T> just works.
- New IHost.ResetAllDataAsync<T>() extension for finer-grained
per-DbContext test teardown. Creates its own scope, resolves the
DbContext first, then the cleaner, then runs delete+reseed.
- New documentation:
* docs/guide/durability/efcore/index.md — Development-time usage
section covering Weasel migrations vs EF Core migrations,
IInitialData mention, and reset guidance.
* docs/guide/durability/efcore/initial-data.md — IInitialData<T>
patterns: class-based vs lambda, layered seeders, idempotency,
when not to use.
* docs/guide/durability/efcore/batch-queries.md — four handler
patterns for the Wolverine batching story, with locally measured
perf numbers (2.78x speedup, 4-query handler) and links out to
Weasel's fluent BatchedQuery reference.
- Weasel link sweep: replaced github.com links with
https://weasel.jasperfx.net/... where applicable.
- ItemService sample: SeedSampleItems IInitialData<ItemsDbContext>
registered via AddInitialData<TContext, TData>(), with a comment
showing the Weasel 8.14 lambda overload.
- Bumps Weasel.* package references to 8.14.0 to pick up the new
LambdaInitialData<T> + AddInitialData lambda overload
(JasperFx/weasel#250).
Tests: 7/7 pass for the cleaner-related suite
(auto_database_cleaner_registration_tests + database_cleaner_usage_tests).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 tasks
This was referenced Apr 21, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ships the four bullets in #2539 except bullet 3 (Specification docs — already shipped):
DatabaseCleaner<>insideUseEntityFrameworkCoreTransactions(). No more per-contextservices.AddDatabaseCleaner<T>(). SeeWolverineEntityCoreExtensions.cs.IHost.ResetAllDataAsync<T>()extension — finer-grained test teardown thanhost.ResetResourceState(). SeeHostResetExtensions.cs.docs/guide/durability/efcore/index.md— Development-time usage section (Weasel migrations,IInitialDataoverview, reset guidance).docs/guide/durability/efcore/initial-data.md— new page onIInitialData<T>patterns.docs/guide/durability/efcore/batch-queries.md— new page on Wolverine's handler-level batch-query patterns with inline perf numbers.github.com/JasperFx/weasellinks withhttps://weasel.jasperfx.net/...where appropriate.ItemServicenow registers aSeedSampleItems : IInitialData<ItemsDbContext>so users browsing the sample see the new pattern in context. A comment shows the Weasel 8.14 lambda overload.Package bump
Weasel.*8.13.0 → 8.14.0 (brings inLambdaInitialData<T>+AddInitialData<T>(Func<T, CancellationToken, Task>)from JasperFx/weasel#250).Performance numbers in batch-queries.md
Measured locally against SQL Server with 4 keyed lookups per iteration:
awaitsBatchedQuerySpeedup scales with number of queries per handler and with network latency.
Test plan
dotnet test --framework net9.0 --filter "FullyQualifiedName~auto_database_cleaner|FullyQualifiedName~database_cleaner_usage"→ 7/7 passdotnet buildonWolverineFx.EntityFrameworkCore,EfCoreTests,ItemService— cleanRelated
🤖 Generated with Claude Code