Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In SAAS architecture, how do I handle db schema and MVC user logins for multi-tenants

Our requirement is something like this.

We are building a multi-tenant website in ASP.NET MVC, and each customer should be able to create their own users as per predefined user roles.

We are thinking about to create a schema for few tables which would be common for customers. So customer can login to system according to their schema logins and we need not to alter any queries to serve all of them.

We are referring http://msdn.microsoft.com/en-us/library/aa479086.aspx Shared Database, Separate Schemas.

Can someone suggest on following 1. After creating schema how to authorize user against a particular schema 2. Is this possible that without any changes in queries db can serve multi-tenants

Thanks in advance Anil

like image 514
ANIL MANE Avatar asked Dec 08 '09 16:12

ANIL MANE


People also ask

How do you implement a multi-tenant database?

We can implement multi-tenancy using any of the following approaches: Database per Tenant: Each Tenant has its own database and is isolated from other tenants. Shared Database, Shared Schema: All Tenants share a database and tables. Every table has a Column with the Tenant Identifier, that shows the owner of the row.

How is database level multi-tenancy achieved?

Multi-Tenant – Multi-tenancy means that a single instance of the software and its supporting infrastructure serves multiple customers. Each customer shares the software application and also shares a single database. Each tenant's data is isolated and remains invisible to other tenants.


1 Answers

After much research, I can say that, although it takes more development up front and more checks along the way, shared database and shared schema is the way to go. It puts a little bit of limits on how easily you can cater to a client's specific needs, but from my point of view SAAS isn't about catering to a single client's weird needs. It's about catering to the majority of clients. Not that it's a SAAS but take iPhone as an example. It was built to cater to the masses. Rather than focusing on doing everything it's built to be one-size fits all just by its simplicity. This doesn't help your case when it comes to authoriztion but it'll save you dev hours in the long run.

like image 112
orokusaki Avatar answered Oct 13 '22 19:10

orokusaki