Shell access external to prj

Topics: Prism v2 - WPF 3.5
Jul 21, 2010 at 9:32 PM

External NUnit prg in the solution, want to access the module catalog to walk through the modules and verify each has a name per the Module attribute. Trying to figure out the best way to approach this, where it doesn't feel naughty. I want the actual instance that is active per the bootstrapper, versus creating additional instances...

Jul 22, 2010 at 3:54 PM

Not sure if this meets what you are looking for, but if you new up your bootstrapper and call run on it, then use the Container property it exposes to resolve the IModuleCatalog, you should be able to do what you are describing.

Jul 23, 2010 at 4:23 PM

The problem seems to be the coupling between the EntLogger it is in a nutshell...

        public void testRemoteSample()
            //UnityBootstrapper bootstrapper = new BootstrapperExtended();

            //IModuleCatalog moduleCatalog = ((BootstrapperExtended)bootstrapper).GetModuleCatalog();

            //foreach (ModuleInfo module in moduleCatalog.Modules)
            //    Assert.IsNotNullOrEmpty(module.ModuleName, "Module name is missing, add module name via [Module(ModuleName = \"Name\"");

    class BootstrapperExtended : Bootstrapper
        public new IModuleCatalog GetModuleCatalog()
            return base.GetModuleCatalog();

Oct 5, 2010 at 6:09 PM


As Brian has mentioned in this thread, the catalog is being registered in the container when calling the Run method in the Bootstrapper.

So you could use the container to retrieve your catalog. This way you avoid calling the GetModuleCatalog method manually.

Regarding to the references, you will need to reference them.

Additionally, the following two methods could help you to understand how to obtain the module name as well as how to create the ModuleInfo:

  1. The EnsureModulesDiscovered method in the ConfigurationModuleCatalog.Desktop.cs class
  2. The CreateModuleInfo method in the DirectoryModuleCatalog.Deskptop.cs class

Fernando Antivero