MEF Import/Export Attributes & strongly Typed Regions

Topics: Prism v4 - Silverlight 4
Sep 8, 2010 at 3:16 PM

Hello to the prism Team.

I would like to ask whether you consider the possibility of creating a region manager implementation using MEF as well as some base classes for Export/Import attributes and metadata. I believe that this would make possible that views could register regions in a strongly typed manner and thus facilitate the extensibility. I have developed a codebase for delivering RIA applications through Silverlight and it is heavily based upon Prism. I could be looking in the wrong direction but it seems that MEF by its own needs heavy glue code to be written, the kind of code that Prism provides.

What are your thoughts towards this direction?

Best regards,


Sep 8, 2010 at 6:31 PM

Hi Constantinos,

Thanks for your feedback, since it is really valuable. I will copy the thread as a work-item, so the all the prism product team is notified as well as the community could vote this.

Take into account that Prism is agnostic of any technology and extensible, so it is something possible to achieve either by the product team as well users. As for the implementation of the region manager using MEF, it could be possible by implementing IRegionManager and updating the bootstrapper to use that custom implementation. 

On the other hand, MEF support have been already developed for modularity in Prism 4, thus you will find IModuleLoader implementation for MEF, custom attributes, etc. But UI-Composition and communication with MEF have not been tackled yet.

Thanks again for your feedback.

Fernando Antivero

Sep 8, 2010 at 6:32 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Sep 8, 2010 at 7:07 PM

Hi Fernando

thanks for the quick reply. I am already considering the option of implementing the IRegionMager interface as there is more than enough reference inside prism. The only thing that stops me from doing that is the upcomming release of prism v4.0. That is because I made a few twicks and tricks in the past and incorporated features that later on were available in a official release (like the NotifyingModuleLoader and the recent Notification and User Interactions).

So I will whait and see what will the new goodies be first.


good work!

Oct 6, 2010 at 3:50 PM

Hi Constantinos,

I think that you can find interesting that in the latest drop (9) of Prism the Stock Trader RI has converted to MEF and MVVM. In this RI, modules are intentionally left empty because views, services and other types are discovered through declarative attributes. For example:

[ViewExport(RegionName = RegionNames.ResearchRegion)]

For more information you could download the latest drop and take a look at the following documentation section in the Prism4.chm:  

  • Stock Trader Reference Implementation (updated)

Additionally, you could check the RI: StockTrader RI\StockTraderRI.sln

Hope this helps.

Fernando Antivero