Reputation: 305
i started to work with prism + unity DI. I have two problems and questions until now.
1. Problem/Question
I would like to use the AssemblyInformation Title as ModuleAttribute.ModelName.
Problem: This doesnt work:
[Module(ModuleName = AssemblyName.GetAssemblyName(Assembly.GetExecutingAssembly().FullName).Name)]
This works well.
[Module(ModuleName ="Module1")]
Question:
Is there any possibility to use AssemblyInformation.Title as ModuleAttribute.Modulename?
2. Problem/Question
I would like to load on demand from Directory my Modules, but only modules which has a special prefix in the module name.
Problem:
If I check my ModuleCatalog, then is still empty before I initialze the modules.
Question:
Is it possible to check before module init the name of the module, because I do not want to exeute the method Initialize() inide of the Module.
My Bootstrapper:
protected override IModuleCatalog CreateModuleCatalog()
{
return new DirectoryModuleCatalog() { ModulePath = @".\Modules" };
}
protected override void ConfigureContainer()
{
base.ConfigureContainer();
}
protected override void InitializeModules()
{
ModuleCatalog moduleCatalog = (ModuleCatalog) this.ModuleCatalog;
// Here I would like to discover my modules with special modulename prefix.
//If the prefix is not found, then I dont want to init the module.
try
{
base.InitializeModules();
}
catch (DuplicateModuleException e)
{
}
}
Module:
[Module(ModuleName = "MyPrefix-Module1")]
public class PrismModule1Module : IModule
{
IRegionManager _regionManager;
public PrismModule1Module(IRegionManager regionManager)
{
_regionManager = regionManager;
}
public void Initialize()
{
Debug.WriteLine("Module init");
}
}
Upvotes: 0
Views: 37
Reputation: 3147
This is achievable, however, by overriding the default implementation.
Upvotes: 1