Multitenancy Techniques for ASP.NET Core
Introduction This will be another post on the multitenancy subject. For now, I plan to write or already wrote: Tenant identification (this article) Data filtering (for EF Core) UI customisation Business logic If you've been following this blog, you know about data filtering with EF Core as an example. This time, I will focus on tenant identification. A tenant is identified by some id. It may have some data, configuration, etc, against it, but, for now, we just want to be able to identify who it is. Tenant Identification When it comes to identifying a tenant, there are some options: A query string parameter (mostly for testing) A route part An HTTP header A JWT token property A cookie Other options might include: Using the HTTP Host header and mapping it to a tenant Using the source IP for the request and mapping it to a tenant I won't cover these for now. A single tenant will be associated with a request, and it won't change during its pro...