How does View Discovery Quickstart load its modules?

Topics: Prism v2 - WPF 3.5
Sep 29, 2009 at 8:31 PM

I've just started doing the Quickstarts, so be kind....

I see in the Modularity quickstarts how modules can be loaded (config, directory, in-code).     

But then the very next quickstart - View Discovery - doesn't appear to use any of these methods.  

The InitializeModules method of its Bootstrapper simply does a Container.Resolve of the module type, with no apparent interaction with a ModuleCatalog (ie, it doesn't override GetModuleCatalog).

To further add to my confusion, the docs state "If you are using the UnityBootstrapper [which the View Discovery quickstart does], you must provide a module catalog instance; if you do not, a run-time exception is thrown".

Since it doesn't get a run-time exception, I assume that the View Discovery quickstart is "providing" a module catalog. But where? And how do the modules get added to it? 






Sep 30, 2009 at 12:01 AM

I’m also starting with Prism so I’ll also ask for kindness, If you check the References in the Solution Explorer you’ll find there’s one for the UIComposition.Modules.Employee and UIComposition.Modules.Project, you’ll also find using clauses in the Bootstrapper, since the project knows about the classes the container can solve them, this is another way for loading modules, is the easiest, but not the best for obvious reasons IMHO.

Sep 30, 2009 at 2:30 PM

Yeah, I saw the references and using statements. 

Although it's still not clear to me how/where those references "automatically" cause the container to be aware of the modules, or to populate the module catalog.  I stepped into the container, but I must have missed that bit. 

But as you said, having hard-coded references isn't the "best" way (IMHO, it's not even in the top ten list of alternatives), given that the idea is to de-couple the app.

It's unfortunate that the quickstart used that technique, if the intent of the "guidance" is to illustrate best practices.





Nov 2, 2009 at 4:05 PM

I'm also a starter one, I am confused and still is not clear to me the same question (specially in the Silverlight quickstart project, because the reflection library isn't implemented).

Is there any important reason to override IntializeModules instead of GetModuleCatalog?