今日已更新 334 条资讯 | 累计 42011 条内容
关于我们

Multitenancy with .NET and EF Core: A Deep Dive (.NET 10)

/u/RemigiuszZalewski 2026年09月11日 17:39 1 次阅读 来源:Reddit r/programming

Ever had a multi-tenant SaaS app where the only thing stopping Customer A from seeing Customer B's invoices is a `Where TenantId ==` clause someone remembered to write? In this deep dive I build real tenant isolation into EF Core 10 - two real tenants with real registration, login and invite flows (no dev-token shortcuts), a named global query filter that scopes every query automatically, and a SaveChangesAsync override that stamps TenantId on every insert so it's never left unset. I also show the one gotcha that makes EF Core 10 worth the upgrade for this: named query filters, so tenant isolation and soft-delete can finally coexist on the same entity instead of one silently overwriting the other. If you've ever shipped multi-tenancy on hope and code review, this is the version that makes the mistake structurally impossible. submitted by /u/RemigiuszZalewski [link] [留言]

本文内容来源于互联网,版权归原作者所有
查看原文