views:

81

answers:

1

I'm working on a project that has the ultimate vaguely-defined requirement: "Site should be 'skinnable' for other clients."

As we all know, there are almost always UI, logic and model changes that have to be made.

I've explained that work will be required to add another client to the site, and that it won't be as simple as creating a new skin. I've also explained that it's impossible to design for the unknown and undefined.

That being said, I'd like to come up with a design that lends itself to re-usability without being overly complex.

I'd like to be able to share as many controllers and views as possible.

I had thought about trying to load a different set of routes (pointing to different controllers) based on the URL the user is using to enter the site (is this even possible?). My thinking was that I could define a set of base controllers and inherit from them for each sub-site.

Is there a better way to do what I'm trying to do?

Could this be done with an IoC container? Are there benefits to such an approach?

How are others handling situations where a single MVC codebase should be shared and mostly reused between different sites?

Thanks for any advice or input!

+2  A: 

The simplest start would be to load different css files in the Master page based on either query variables or Web.config values if the sites will reside on different servers. Another way of doing this is to create your own CSSResult which inherits from ActionResult which returns the css file based on requesting domain. If you'd like more control over which view is shown, you can create a class which inherits from the IViewEngine interface and display different Views based on the requesting domain.

Yuriy Faktorovich