0

I have two modules:

[Module(ModuleName = ModuleNames.Common)]
public class CommonModule: BaseModule

and

[ModuleDependency(ModuleNames.Common)]
[Module(ModuleName = ModuleNames.Branch, OnDemand = true)]
public class BranchModule : BaseModule

Then I register them like this, in Bootstrapper.ConfigureModuleCatalog:

ctlg.AddModule(ModuleNames.Common, typeof(CommonModule).AssemblyQualifiedName, InitializationMode.WhenAvailable);
ctlg.AddModule(typeof(BranchModule), InitializationMode.OnDemand);

When I inspect the module catalogue, only CommonModule is correctly configured, because I specify all the module attributes in AddModule, not because of its [Module(ModuleName = ModuleNames.Common)] attribute. These attributes seem to plain be ignored, because despite BranchModule having two attributes, but I don't supply that info in AddModule, in the catalogue, this module's name is its type name, and it has no dependencies.

What are these attributes for if I still have to duplicate the same info when calling AddModule?

ProfK
  • 49,207
  • 121
  • 399
  • 775
  • 1
    RTFM: http://prismlibrary.readthedocs.io/en/latest/WPF/04-Modules/ – R. Richards Feb 02 '17 at 18:37
  • @R.Richards The FM doesn't come close to answering my question. It shows to use attributes exactly as I have used them, but what the FM shows isn't working, hence me asking this F question after reading the FM. – ProfK Feb 02 '17 at 21:07
  • 1
    Some F Code then, perhaps? https://github.com/PrismLibrary/Prism/blob/a60d38013c02b60807e9287db9ba7f7506af0e84/Source/Wpf/Prism.Wpf/Modularity/DirectoryModuleCatalog.Desktop.cs. Toward the bottom. You may have found this already. Maybe this is only used in this situation. – R. Richards Feb 02 '17 at 21:44
  • Aha! Thank you so much, @R.Richards! I am not using a `DirectoryModuleCatalog`, just a vanilla `ModuleCatalog`, and looking at that source shows the attributes aren't used at all. I'll raise this with MS. – ProfK Feb 03 '17 at 03:37
  • You may just want to log an issue here: https://github.com/PrismLibrary/Prism/issues. Good luck! – R. Richards Feb 03 '17 at 11:46
  • Thanks, @R.Richards. I am even thinking of fixing it myself and putting in a pull request. I've been totally inactive in open source, except for logging VS 2017 bugs, for far too long. – ProfK Feb 03 '17 at 15:23
  • I like the idea of that. I know that team would appreciate it. – R. Richards Feb 03 '17 at 15:48

1 Answers1

0

With the gracious help of R. Richards, up in the OP comments, and looking at the Prism source, I found out these attributes are only used in module discovery, particularly with DirectoryModuleCatalog, but I hazard a guess with other module discoveries as well. With these you have no hook to add the info carried by the attributes, but with direct module registration, in a plain ModuleCatalog, they've selfishly left that all up to you.

ProfK
  • 49,207
  • 121
  • 399
  • 775