3587 Views
In this post I'll show how to add multi-tenancy to an ASP.NET Core application using the open source SaasKit, and store tenant mappings in a database. Building a multi-tenant application can be a difficult thing to get right - it's normally critical that there is no leakage between tenants, where one tenant sees details from another. In the previous version of ASP.NET this problem was complicated by the multiple extension points you needed to hook into to inject your custom behaviour. With the advent of ASP.NET Core and the concept of the 'Middleware pipeline', modelled after the OWIN interface, this process becomes a little easier. The excellent open source project SaasKit, by Ben Foster, makes adding multi-tenancy to your application a breeze. In this post I'll show how to add multi-tenancy to an ASP.NET Core application where the tenant mapping is stored in a database.