ConjoinedMultiTenantedEfCore sample app + CrossTenantWriteException message fix (GH-3465) - #3515
Merged
Merged
Conversation
…ulti-tenancy (GH-3465) New sample app mirroring the motivating shared-database multi-tenancy scenario (barretblake.dev multi-tenant series) and showing how Wolverine automates every pain point: - ITenanted Invoice entity + vanilla DbContext (tenant_id mapping and global query filter applied by Wolverine, zero tenancy code) - AddDbContextWithWolverineManagedConjoinedTenancy registration with Wolverine.Http header/query-string tenant detection + AssertExists - Stamp-on-insert POST endpoint that never touches TenantId, cascading a tenant-carrying message to a durable local queue handler - Deliberate IgnoreQueryFilters hijack endpoint demonstrating CrossTenantWriteException rejection - Tenant-scoped queries through both HTTP endpoints and handlers - Commented opt-in Weasel-managed PG partitioning (PartitionPerTenant) - wolverine_tenants registry endpoints (list/add/disable/enable/remove) via IDynamicTenantSource<string>, seeded with two demo tenants net9.0 only, matching every other Npgsql-EF project in the repo until the EF 10 Npgsql provider GAs. Validated against dockerized PostgreSQL (5433): clean startup plus curl round trips for stamping, isolation, missing-tenant 400, cross-tenant 404/rejection, and registry lifecycle. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J4XSARYV567q5Y3fW6iwiu
This was referenced Jul 20, 2026
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.
The full-tour sample app for the conjoined EF Core multi-tenancy epic, closing out the Wolverine-side work on #3465 for 6.21 (naming decisions recorded on the issue — both public names stay as shipped in #3498).
The sample (
src/Samples/ConjoinedMultiTenantedEfCore)Mirrors the motivating hand-rolled-tenancy blog scenario and shows Wolverine automating each pain point, validated live against dockerized Postgres with a scripted curl tour (README):
ITenantedInvoice + non-tenanted Product counter-example; deliberately vanillaDbContextAddDbContextWithWolverineManagedConjoinedTenancy<T>+ HTTP tenant detection (header/query/AssertExists())TenantId, cascading a tenant-scoped message to a durable local queue handlerIgnoreQueryFilters()hijack endpoint demonstratingCrossTenantWriteExceptionwolverine_tenantsregistry CRUD viaIDynamicTenantSource<string>([NotTenanted]endpoints), seeded tenantsPartitionPerTenant()opt-inValidated: build clean, full-solution restore clean, live round trips for every bullet above.
Also in this PR
CrossTenantWriteExceptionmessage grammar fix ("Cannot modified entity..." → "Cannot apply a 'Modified' change to an entity..."); no test asserts the text; the 34 conjoined compliance tests are green locally.API-friction follow-ups from building the sample (DbContext body-inference footgun, RuntimeCompilation docs mention, Npgsql-EF net10 pin, partition-existing-table story) are recorded on #3465.
🤖 Generated with Claude Code
https://claude.ai/code/session_01J4XSARYV567q5Y3fW6iwiu