Skip to content

EF Core dev-time improvements (GH-2539)#2543

Merged
jeremydmiller merged 1 commit intomainfrom
feature/2539-interview
Apr 20, 2026
Merged

EF Core dev-time improvements (GH-2539)#2543
jeremydmiller merged 1 commit intomainfrom
feature/2539-interview

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

Ships the four bullets in #2539 except bullet 3 (Specification docs — already shipped):

  1. Auto-register DatabaseCleaner<> inside UseEntityFrameworkCoreTransactions(). No more per-context services.AddDatabaseCleaner<T>(). See WolverineEntityCoreExtensions.cs.
  2. New IHost.ResetAllDataAsync<T>() extension — finer-grained test teardown than host.ResetResourceState(). See HostResetExtensions.cs.
  3. New documentation:
    • docs/guide/durability/efcore/index.md — Development-time usage section (Weasel migrations, IInitialData overview, reset guidance).
    • docs/guide/durability/efcore/initial-data.md — new page on IInitialData<T> patterns.
    • docs/guide/durability/efcore/batch-queries.md — new page on Wolverine's handler-level batch-query patterns with inline perf numbers.
  4. Weasel link sweep — replaced github.com/JasperFx/weasel links with https://weasel.jasperfx.net/... where appropriate.
  5. Sample updatesItemService now registers a SeedSampleItems : 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 in LambdaInitialData<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:

Strategy Total (50 iters) Per handler Relative
Sequential awaits 345.8 ms 6.92 ms 1.0×
Batched via BatchedQuery 124.3 ms 2.49 ms 2.78×

Speedup 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 pass
  • dotnet build on WolverineFx.EntityFrameworkCore, EfCoreTests, ItemService — clean
  • Full CI across net8 / net9 / net10

Related

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant