DDD

DDD 8 - 30th Jan 2010

Multi-tenant ASP.NET MVC Projects (Or 30 very different customers and a single codebase)


Rob Ashton

If you're like us, and develop bespoke, but very similar software for each of your customers, then you'll have felt the pain of having to make compromises between flexibility and the amount of effort required to maintain the software for each of those customers.

It's very easy to start off with a base product, branch off for each of your customers, make changes according to their wishes and ship on time.

Then you need to start maintaining those different code-bases, and in time they diverge further and further until rolling fixes from your base into those different branches becomes a non-trivial task.

If you're working with high profile customers, then saying no and doing away with the complete flexibility that the above option provides is not really a option from a business perspective.

In PHP or ASP, you can execute code as and when you please, and you can write plug-in systems to allow for highly customisable applications - but you can very easily end up with spaghetti, or hard to maintain code, and you haven't got access to the amazing frameworks that .NET has given us in recent years.

In ASP.NET Forms, you can load in controls from assemblies or other sources, and maintain some semblance to the above plug-in architecture; however it is generally agreed that ASP.NET Forms has many disadvantages which we've overcome and dropped in moving to ASP.NET MVC

On the surface, ASP.NET MVC looks to be a very static beast, you create your views, your controllers and your models and develop an application for a purpose. Job done.

It doesn't seem to naturally provide us with what we want - the ability to have a base product, with all functionality provided by plug-ins, the ability to theme everything, override/replace any views/partial views and replace blocks of controller logic on a per customer basis.

MVC 2 goes some way towards the first of these goals with "areas", but the flexibility is still not there for our goal of having a single product which is seemingly bespoke for each customer but still operating off a single code base.

There are a number of options for creating completely pluggable ASP.NET MVC applications, with the ability to have your own view engines, controller factories and etc helping tremendously towards those aims.

This session aims to cover some of those options, and to demonstrate what happens when you package up these concepts into a framework you can use to make any product as flexible as you like.

Latest News

Photos