Hi,
Based on my understanding, the default ConfigureContainer method of the bootstrapper tries to register the ModuleCatalog in the container. However, as we delayed the creation of the ModuleCatalog until the DoModuleConfig is executed, the ConfigureContainter method fails. A possible approach to workaround this is to include the logic of the original ConfigureContainer method in the overriding version but without registering the ModuleCatalog. Then, you could register the ModuleCatalog in the DoModuleConfig method. As a result, your ConfigureContainer method should be like this:
And the DoModuleConfig like this:
Regards,
Damian Cherubini
http://blogs.southworks.net/dcherubini
Based on my understanding, the default ConfigureContainer method of the bootstrapper tries to register the ModuleCatalog in the container. However, as we delayed the creation of the ModuleCatalog until the DoModuleConfig is executed, the ConfigureContainter method fails. A possible approach to workaround this is to include the logic of the original ConfigureContainer method in the overriding version but without registering the ModuleCatalog. Then, you could register the ModuleCatalog in the DoModuleConfig method. As a result, your ConfigureContainer method should be like this:
protectedoverridevoid ConfigureContainer() { this.Container.AddNewExtension<UnityBootstrapperExtension>(); Container.RegisterInstance<ILoggerFacade>(Logger); RegisterTypeIfMissing(typeof(IServiceLocator), typeof(UnityServiceLocatorAdapter), true); RegisterTypeIfMissing(typeof(IModuleInitializer), typeof(ModuleInitializer), true); RegisterTypeIfMissing(typeof(IModuleManager), typeof(ModuleManager), true); RegisterTypeIfMissing(typeof(RegionAdapterMappings), typeof(RegionAdapterMappings), true); RegisterTypeIfMissing(typeof(IRegionManager), typeof(RegionManager), true); RegisterTypeIfMissing(typeof(IEventAggregator), typeof(EventAggregator), true); RegisterTypeIfMissing(typeof(IRegionViewRegistry), typeof(RegionViewRegistry), true); RegisterTypeIfMissing(typeof(IRegionBehaviorFactory), typeof(RegionBehaviorFactory), true); RegisterTypeIfMissing(typeof(IRegionNavigationJournalEntry), typeof(RegionNavigationJournalEntry), false); RegisterTypeIfMissing(typeof(IRegionNavigationJournal), typeof(RegionNavigationJournal), false); RegisterTypeIfMissing(typeof(IRegionNavigationService), typeof(RegionNavigationService), false); RegisterTypeIfMissing(typeof(IRegionNavigationContentLoader), typeof(RegionNavigationContentLoader), true); Container.RegisterInstance(typeof(UserPrincipal), userPrincipal, new ContainerControlledLifetimeManager()); }
publicvoid DoModuleConfig() { this.ModuleCatalog = this.CreateModuleCatalog(); if (this.ModuleCatalog == null) { thrownew InvalidOperationException("NullModuleCatalogException"); } this.Container.RegisterInstance(this.ModuleCatalog); this.ConfigureModuleCatalog(); this.InitializeModules(); }
Damian Cherubini
http://blogs.southworks.net/dcherubini