Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to keep in mind when developing a multi-tenant asp.net MVC application?

Good afternoon - I have a pretty general question today - I've been tasked with creating a web application to manage some basic information on customers. It's a very simple application, but what I don't know is what to keep in mind to develop the site around supporting multiple users at their own domains or subdomains of our url?

How would I restrict users from logging in to each others portion of the app?

I've seen mention of database scoping in similar questions on Stack Overflow, could anybody elaborate on best practices for an implementation like this?

Are there any new features in MVC3 to support multi-tenancy? I am facing this issue with MVC2 and my eCommerce site where we decided we wanted it white-labeled and customizable for multiple shop owners, and don't know where to begin in implementing these features in an existing application. Any input is appreciated.

edit

To elaborate on multi-tenancy, what I mean - in the context of a store for example, multiple users sign up for their own store at www.mystore.com and are each given a unique subdomain to access their own instance of the store, at user1.mystore.com, user2.mystore.com etc. Each store would have customers with order histories, and those customers would have logins. I would need to restrict customers of user1.mystore.com from logging in at user2.mystore.com without a new account, and likewise prevent user2.mystore.com from accessing user1.mystore.com's customer history.

like image 928
Grahame A Avatar asked Feb 10 '11 23:02

Grahame A


1 Answers

I implemented a complete MVC multi-tennant app. Here are some links I found handy and some sample apps:

http://msdn.microsoft.com/en-us/library/aa479086.aspx

http://codeofrob.com/archive/2010/02/14/multi-tenancy-in-asp.net-mvc-controller-actions-part-i.aspx

http://www.developer.com/design/article.php/10925_3801931_2/Introduction-to-Multi-Tenant-Architecture.htm

http://msdn.microsoft.com/en-us/library/aa479086.aspx#mlttntda_cc

http://lukesampson.com/post/303245177/subdomains-for-a-single-application-with-asp-net-mvc

http://code.google.com/p/multimvc/

http://www.paulstovell.com/widgets

http://www.agileatwork.com/bolt-on-multi-tenancy-in-asp-net-mvc-with-unity-and-nhibernate/

http://ayende.com/blog/3530/multi-tenancy-approaches-and-applicability

http://weblogs.asp.net/zowens/archive/tags/Multi-tenancy/default.aspx

http://cloudsamurai.codeplex.com/

http://cloudninja.codeplex.com/

http://msdn.microsoft.com/en-us/library/hh534484.aspx

http://blog.maartenballiauw.be/post/2009/05/20/ASPNET-MVC-Domain-Routing.aspx

http://blog.tonywilliams.me.uk/asp-net-mvc-2-routing-subdomains-to-areas

Even starting from scratch, you are in for a world of hurt. The MVC framework does very little to help you address the issues.

like image 98
rboarman Avatar answered Nov 15 '22 22:11

rboarman