title: PRISM: Using MVVM, how to resolve or inject in a constructor objects?
body: <p>I'm using MVVM and PRISM. In the project, I've got a common interface called IFoo and others modules should implement this interface and registered it.</p>
  
  <pre><code>// Common module
  public interface IFoo { }
  
  // Module1 module
  public class Foo1 : IFoo { }
  </code></pre>
  
  <p>Then when I initialize the module1, I register my type and navigate.</p>
  
  <pre><code>_container.RegisterType&lt;IFoo, Foo1&gt;(new ContainerControlledLifetimeManager());
  _container.RegisterType&lt;Object, View1&gt;("View1");
  
  var module = new Uri("View1", UriKind.Relative);
  _regionManager.RequestNavigate("MainRegion", module);
  </code></pre>
  
  <p>View1 constructor contains viewModel, this view model has in its constructor:</p>
  
  <pre><code>    public ViewModel1(IFoo foo, IEventAggregator eventAggregator, IRegionManager regionManager)
      {
          ...
      }
  </code></pre>
  
  <p>Until this, is okay. But later, I need to get the Foo1 from external modules. So, I set another registry to mapping name for Foo1:</p>
  
  <pre><code>_container.RegisterType&lt;IFoo, Foo1&gt;(new ContainerControlledLifetimeManager());
  _container.RegisterType&lt;IFoo, Foo1&gt;("foo1", new ContainerControlledLifetimeManager());
  </code></pre>
  
  <p>And right, it's working for me, but I don't like the idea to have two instances separated. I need to have just one, and accesing to the same instance.</p>
  
  <p>Is there a way to fix this scenario?
  Thanks in advance.</p>
  
  <p>Anyway, I attach a Zip where contains a demo which represents my problem.
  <a href="http://www.mediafire.com/?feod8x0b952457e" rel="nofollow">http://www.mediafire.com/?feod8x0b952457e</a></p>