Reputation: 38189
I have just one module in Prism
application. Let this module have name ModuleA
and application name is "CoolAppl"
. This application is cool and it works really okay in production. Once some guy would like to add new button, for example "Delete Person"
, to this application "CoolAppl"
.
My question is can I or another guy from another city add new button "Delete Person"
to ModuleA
of application "CoolAppl"
without recompilation any module just by adding dll with necessary button Delete Person
?
If it is possible, please, provide me direction where I should dig/search:).
I am using a such mechanism of navigation:
Uri wholeView = new Uri("ModuleA", UriKind.Relative);
regionManager.RequestNavigate(RegionNames.TheBottomRegion, wholeView);
var currentView = regionManager.Regions[RegionNames.TheWholeRegion].Views.ElementAt(0);
regionManager.Regions[RegionNames.TheWholeRegion].Remove(currentView);
And class to identificate modules looks like that:
public class ModuleAModule : ModuleBase, IModule
{
private readonly IRegionManager _regionManager;
private readonly IUnityContainer _container;
public ModuleAModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager)
{
_regionManager = regionManager;
_container = container;
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.TheWholeRegion, typeof(LoginControl));
}
protected override void RegisterTypes()
{
Container.RegisterType<IViewModel, MyViewModel>();
Container.RegisterTypeForNavigation<MySuperControl>();
}
}
Upvotes: 1
Views: 102
Reputation: 10873
If no recompilation means "not recompile everything", then you can just recompile ModuleA. If it means "recompile nothing at all", you're out of luck. If the new button doesn't need to be in ModuleA, you can create a new ModuleB without either recompiling CoolAppl or ModuleA (but you need to compile ModuleB).
You might have put a plugin-system in place, though, that loads the buttons from plugins, then you can add another plugin for the new button.
Upvotes: 2