Why PRISM 4 is Conceptually Wrong?

Topics: Prism v4 - WPF 4
Jul 19, 2010 at 4:49 PM

Hi All.

I have been using PRISM 2 for a long time. It is pretty easy to specify module info in the Shell with UnityBootstrapperv.GetModuleCatalog. Recently I need to move to PRISM 4. So I downloaded PRISM 4 Drop 4. To my surprise, this method has gone. The new samples use a different approach to specify the module info in the Shell. What really shocked me was the new approach needs to add reference of modules to the Shell. Thus modules and shell are tightly coupled. This is totally wrong! Any thoughts and advice?

Jul 19, 2010 at 5:19 PM

There are still a number of options for bringing modules into your application:

  • Hard reference and adding modules directly in code in the bootstrapper
  • Using XAML
  • Using configuration (in WPF, but not silverlight)
  • Pointing prism at a folder and having it import all the modules it finds (in WPF, but not silverlight)

The modularity quickstarts show all four options in one sample, so you can see the basics of each approach. As a result, there are a few modules that are hard referenced for showing the first option.  There are a few others that are discovered via XAML, config, or directory sweep. 

The GetModuleCatalog method was renamed for consistency as the Bootstrapper base class was pulled out and a few patterns that would probably be in any bootstrapper were distilled out.  If you rename your existing GetModuleCatalog method to CreateModuleCatalog, you should be in good shape.  There were one or two other renames and minor re-orangization in the bootstrapper, but they should be fairly obvious.  WHen I updated the Stock Trader RI to work with the new version of the UnityBootstrapper, I think I changed about five lines of code, maybe six, in the bootstrapper;  nothing else needed to change for it to work. 

In the next drop, we should have some solid documentation around the way modularity works, which is mostly the same as before with a few minor changes that facilitated the integration of MEF as another option for the DI container. 

I hope that helps,

Michael Puleio

Aug 5, 2010 at 4:16 PM
Edited Aug 5, 2010 at 5:53 PM
Michael, Your answer is in the context of bringing in modules to be loaded I'm assuming. However, I'm using GetModuleCatalog just to get a list of modules that have been loaded. I do this to build a list in my view model. My menu is then populated based on this list as an available menu items for opening views. Therefore, in version 4 how am I going to be able to get this list? Thank You.