In my prism application I'm getting the error Activation error occured while trying to get instance of type CustomerModule, key \"\".
It's caused by the fact that my customers module I'm trying to inject a "menuManager" of type IMenuManager:
namespace CustomerModule
{
public class CustomerModule : IModule
{
private readonly IRegionManager regionManager;
private readonly IUnityContainer container;
private readonly IMenuManager menuManager;
public CustomerModule(IUnityContainer container,
IRegionManager regionManager,
IMenuManager menuManager)
{
this.container = container;
this.regionManager = regionManager;
this.menuManager = menuManager;
}
public void Initialize()
{
container.RegisterType<IMenuManager, MenuManager>(new ContainerControlledLifetimeManager());
...
However, if I change the CustomerModule constructor to inject a type instead of an interface, then it works:
public CustomerModule(IUnityContainer container,
IRegionManager regionManager,
MenuManager menuManager)
So where do I need to register my MenuManager as implementing IMenuManager? It seems that registering it in CustomerModule's Initialize method is too late.
ANSWER:
I put it in ConfigureContainer() and it worked fine, be sure to leave in "base.ConfigureContainer()":
protected override void ConfigureContainer()
{
base.ConfigureContainer();
Container.RegisterType<MenuManager>(new ContainerControlledLifetimeManager());
}