Multiple sites from same codebase - Multi-Tenant Architecture

Topics: Web Client Software Factory, Project Management Forum, User Forum
Sep 16, 2007 at 7:36 PM
I'm searching for information on how to make a web application where the codebase can be used by multiple sites just like DotNetNuke. What exactly must be done to make my web application, created with WCSF, to be installed as one instance on a web server, but multiple sites can use the same installation?

I have not read much about SaaS yet but so far I cant find anything that says: Hey, you have to do that and then do that. Do I have to create a HttpHandler? Or do I have to write some lines in the Global.asax.cs file and if so, what? How much effort must be done before my WCSF-application support this multi-tenant functionality?

Please tell me if this is a lame question and there is some obviouse things that I should have known.


Sep 18, 2007 at 6:02 PM
Edited Sep 18, 2007 at 6:03 PM

In essence, multi-tenancy is a site that is driven by metadata in order to allow it to look and behave differently depending on the customer who is accessing. In a multi-tenant solution, the customer data all lives in the same place and is tagged with additional metdata that defines which customer the data belonds to for example in the simplest form imagine each row of data tagged with a CustomerID. There are actually several variations on this where you can have seperate databases / servers for each customer, however this is not a long-term scaleable solution for many customers.

As to WCSF, we don't give specific guidance within the factory on building SaaS sites. However, there are several capabilities within WCSF that play very well in a multi-tenant solution.
  • Services - CWAB sites are heavily service centric, and the service implementation can be dynamically replaced. This allows you to change on the fly the functionality depending on the customer. Services in this case are not strictly web services (though they include them) but are also your own custom objects that you want to be available throughout your application.
  • Modularity - In CWAB, the web site is divided into separately deployable and loadable modules that are loaded at runtime. By building a module site you can turn on and off different portions of the site depending on the customer. This also plays well with the previous point in that within each module the Services can change depending on the customer metadat, etc.
  • Dependency Injection - Modules within CWAB do not have to be responsible for managing and creating their dependencies. Using metadata they can have them injected at runtime. This means the dependencies can change based on the customer.
  • MVP Separation - Within WCSF we give guidance on using the MVP pattern meaning that the UI (View) is abstracted from the UI business logic (Presenter). The main reason we do this is to provide testability of the UI however, the other benefit MVP yields is allowing you to reskin your presenters with multiple Views. This means CustomerA might have a completely different look and feel from CustomerB.

For more info on SaaS and multi-tenant architecture, check here. Also check out Eugenio Pace's blog. Also if guidance on SaaS is something you'd like to see us deliver, please go add a WorkItem in the Issue Tracker so other's can vote.

Hope this helps
Sep 24, 2007 at 12:18 PM
Thanks Glenn

Your answer did at least trigger some new thoughts in my mind. But I'm not sure I'm able to take the necessary steps to fullfill my goal yet.

Maybe I should phrase my question differently because I think I have read something, some time ago, about making an HttpHandler or something to read request-headers and route the user(request) to the desired website. And I feel that is the way I want to go and then we may NOT talk about multi-tenant architecture, right? I just want my application to be easily hosted by an ASP that may have multiple sites but that dont want to have the application source spread over multiple (virtual) catalogs. Can anyone enlight me here? I have a feeling I'm a bit lost in space here and I have not had the time to read enough about the SaaS yet.