Multi-tenancy is a widely used architecture to build Software as a Service applications. In a multi-tenant application, tenants (customers) may share the same infrastructure, application and database without interfering with each other. They have their own users, roles, permissions, settings and data isolated from other tenants.
In this talk, we will see the problems of multi-tenancy and different options to solve them with real world scenarios and code samples.
The following topics will be covered in the talk:
- SaaS and multi-tenancy: benefits and difficulties.
- Deployment and database options and best practices.
- How to determine, get and change the current tenant in the application code (using ambient context pattern).
- How to implement an ASP.NET Core middleware to determine the current tenant.
- Data isolation (between tenants): dynamically select the connection string and automatically filter data for the current tenant (EF Core Global Query filters, SQL RLS and other options).
- Safe way of manipulating the data.
- Enable/disable multi-tenancy for a required scope.
- Database migrations in a multi-tenant multi-database system.
- Packages and features in a SaaS application.