I am using Prism v7.2.0.1422 for a WPF app with .net Core 3.1. I am using the Microsoft Dependency Injection for DI.
I don't want use Unity container. regionAdapterMappings is empty. View discovery and view injection don't work. what do I need to be able to register regions in regionManager ?
MyPrismApplication.cs
public abstract class MyPrismApplication : PrismApplicationBase
{
protected override IContainerExtension CreateContainerExtension()
{
return PrismContainerExtension.Current;
}
protected override void RegisterRequiredTypes(IContainerRegistry containerRegistry)
{
base.RegisterRequiredTypes(containerRegistry);
containerRegistry.RegisterSingleton<IRegionNavigationContentLoader, RegionNavigationContentLoader>();
containerRegistry.RegisterSingleton<IServiceLocator, MicrosoftServiceLocatorAdapter>();
}
protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)
{
base.ConfigureRegionAdapterMappings(regionAdapterMappings);
//Fix bug when RegionAdapterMappings are not registered into dependency container
PrismContainerExtension.Current.RegisterInstance(regionAdapterMappings);
}
}
the boolean requiresRebuild destroy all instances inside the container.
Prism v7.2.0.1422. .net Core 3.1 Prism.Container.Extensions v7.2.0.54.
This isn't something that is currently supported out of the box. If you look back at the Prism 7.2 source code for either DryIoc or Unity, you'll see that there is some additional container work which cannot be abstracted out in the PrismContainerExtensions. Specifically you'll need to create ServiceLocatorAdapter.
This requirement goes away for Prism 8, however I have not had the time to update the Prism Container Extensions for Prism 8 and won't until after the next Prism 8 preview. In the mean time I suggest opening an issue on GitHub to track WPF support for the Microsoft.Extensions.DependencyInjection container.