Can anyone explain the difference between this way of loading modules in Prism:
protected override void InitializeModules()
{
IModule customerModule = Container.Resolve<CustomerModule.CustomerModule>();
IModule helloWorldModule = Container.Resolve<HelloWorldModule.HelloWorldModule>();
customerModule.Initialize();
helloWorldModule.Initialize();
}
and this way:
protected override IModuleCatalog GetModuleCatalog()
{
ModuleCatalog catalog = new ModuleCatalog()
.AddModule(typeof(CustomerModule.CustomerModule))
.AddModule(typeof(HelloWorldModule.HelloWorldModule));
return catalog;
}
I've seen both ways in demos but as far as I can tell they do the same thing, both seem to pass in a container and regionManager that I need in my modules:
public class CustomerModule : IModule
{
public IUnityContainer Container { get; set; }
public IRegionManager RegionManager { get; set; }
public CustomerModule(IUnityContainer container, IRegionManager regionManager)
{
Container = container;
RegionManager = regionManager;
}
public void Initialize()
{
RegionManager.RegisterViewWithRegion("MainRegion", typeof(Views.CustomerView));
}
}