MEF vs ASP.NET MVC 2's Portable Areas

Apr 23, 2010 at 10:03 PM
Edited Apr 24, 2010 at 9:09 AM


I'm starting to love MEF but I have some doubts concerning MEF used in an ASP.NET MVC 2 app.

I downloaded and tried some MVC and MEF integration samples but they are quite old and cannot be built against the latest MEF preview 9.

But now I can see that the MVCContrib has a feature called Portable Areas ( |


So my questions are:

1. Is the Portable Area feature kind of making MEF unhelpful when trying to build a plugin based system for an ASP.NET MVC 2 app?

2. In what scenarios should I use MEF over Portable Areas and vice versa in a typical ASP.NET MVC 2 app with a plugin based architecture?

It would be awesome if the MEF experts can write a demo app.

Thanks in advance.

Apr 24, 2010 at 8:22 AM
Edited Apr 24, 2010 at 8:24 AM

I have similar concerns.

My concerns are a bit different though.

  1. I think Portable Areas make MEF even MORE relevant and wonder more about how to package them correctly.
  2. How do I propely integrate Silverlight into a MEF based system hosted by MVC2
    1. How do I keep the Silverlight App from reinitializing on every page, i.e a Silverlight Menu in an MVC2 App.

There are some very interesting patterns here that need to be fleshed out as best practices.

Where should we start in architecting applications of the following nature:

  1. ASP.Net MVC2 Host
  2. Some Data delivered as MVC with HTML/JSON/JQuery
  3. Some Data delivered as Silverlight, i.e. Menus, Charting, Data Entry, Scheduling, Video and Images.
  4. Data delivered via RIA or WCF or JSON/NoSQL

Mixing MVC2, Silverlight, MEF and Rx and NoSQL are a passion I am pursuing as the next great content delivery system and they need to have the base patterns designed for general use.

n.b.: NoSQL in the "Not Only" SQL vein where Document Databases deliver cached core functionality such as Customers and Addresses while SQL Transactions deliver Financial data such as Invoice Items.

Our world just gained even more complexity and will need new patterns... Who wants to help define the patterns that define the next generation of Apps?

Steele Price
Microsoft MVP