English 中文(简体)
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

问题回答

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.

If you are asking this in the context of SQL Server authentication/authorization mechanism, i can asnwer this question with saying that every user has a default schema which helps query engine to find out required object in the database.

SQL Query Engine will look at the user s default schema first to find the required object (table). If it founds the object in user s schema then use it, otherwise goes to system default schema (dbo) to find it.

Check this article s How to Refer to Objects section to find out how it works. The article also has some information about security concepts related to schemas.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签