Skip to main content
InterviewHubPRO
Section Overview
Q50

Question 50 of 50

Part 3: Distributed Systems, Kestrel Internals & Scalability (25 - 35)

100%
ASP.NET Core & Web API (50 Qs)•Part 3: Distributed Systems, Kestrel Internals & Scalability (25 - 35)

Multi-Tenant Architecture in ASP.NET Core.

senior LevelSystem Design

In Simple Words:

  1. Database-per-Tenant: Highest security isolation. Middleware resolves tenant from subdomain/header and dynamically configures EF Core connection string per request.
  2. Schema-per-Tenant: Shared database, separate schema per tenant.
  3. Shared Database with Discriminator Column: All tenants share tables with a TenantId column. Configured with EF Core Global Query Filters (modelBuilder.Entity<T>().HasQueryFilter(e => e.TenantId == _currentTenantId)), automatically preventing cross-tenant data leaks across all queries!