Hi when I am looking at the implementation of PrismApplicationBase I found following piece of code
/// <summary>
/// Registers all types that are required by Prism to function with the container.
/// </summary>
/// <param name="containerRegistry"></param>
protected virtual void RegisterRequiredTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterInstance<IContainerExtension>(_containerExtension);
containerRegistry.RegisterSingleton<ILoggerFacade, EmptyLogger>();
containerRegistry.RegisterSingleton<IApplicationProvider, ApplicationProvider>();
containerRegistry.RegisterSingleton<IApplicationStore, ApplicationStore>();
containerRegistry.RegisterSingleton<IEventAggregator, EventAggregator>();
containerRegistry.RegisterSingleton<IDependencyService, DependencyService>();
containerRegistry.RegisterSingleton<IPageDialogService, PageDialogService>();
containerRegistry.RegisterSingleton<IDeviceService, DeviceService>();
containerRegistry.RegisterSingleton<IPageBehaviorFactory, PageBehaviorFactory>();
containerRegistry.RegisterSingleton<IModuleCatalog, ModuleCatalog>();
containerRegistry.RegisterSingleton<IModuleManager, ModuleManager>();
containerRegistry.RegisterSingleton<IModuleInitializer, ModuleInitializer>();
containerRegistry.Register<INavigationService, PageNavigationService>(NavigationServiceName);
}
we can see that the last registration for the navigation service is NOT singleton.
So my two questions are:
- Why the registration for the
INavigationServiceis not singleton like other services ? - Why do we assign a name for it (i.e.
NavigationServiceName)