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
?
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.