views:

47

answers:

2

I'm designing a Module that is to be consumed by two distinct WebSites. Everything will be written in MVC (the module and both web applications).

I would like to design my module so that the code can be included from a shared location. I only want to maintain a single version. My first thought was the Area feature of MVC 2. But from my reading it appears as though MVC 2 only "officially" supports Inline Areas.

It sounds like MultiProject support for Areas could be dropped in the near future. http://stackoverflow.com/questions/1526631/what-are-the-pros-and-cons-of-areas-implemented-as-single-projects-vs-multiple-pr

Are there any alternatives?

A real world example of my design would be creating an MVC Shopping Cart (this would be the shared Module) and consuming it on two different MVC web sites (say a Book Store and a Bicycle Parts Store).

A: 

You can still make it an Area, maintain it in one place and copy it to other projects when needed. There's no way I know to make it work out of the box without setting up the appropriate routes in the consuming web project.

Other than that, I would be interested in a solution too.

mare
Sadly that may need to be the approach.Ideally I would develop it in its own project where I can include some testing tools.The notion of "copy it to other projects" isn't exactly my ideal of maintainable code. Among other things I'd have to keep it in sync when something changes and monitor other developers to make sure they don't change the wrong copy. Sounds like a big headache to me.
Justin
+1  A: 

MVC Contrib's Portable Areas are just what you need: http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx

My experience has been nothing but positive. Have 3 apps sharing 3 portable areas. One is going into production pretty soon.

jfar
Thanks for the suggestion jfar. What made this a more attractive option to you than Multiple Project Areas?Correct me if I'm wrong but it appears as though the Portable Areas for MVC-Contrib build assemblies (ie. binary libraries) that you consume as references in your application. For ease of debugging and development I usually like to add modules like this as source.
Justin