title: Unity Web API - Register Service From Different Assembly
body: <p>I'm using web api 2 with unity 4.
  My solution consists of project A and project B.
  Project A contains a controller with a constructor requiring a parameter of type IA.
  Project B conatins a class name A that inherites from IA.</p>
  
  <p>I am trying to inject A into the controller, but failing as I'm receiving an error that the controller has no parameters less constructor.</p>
  
  <p>This is the code I'm using in WebApiCongig.cs:</p>
  
  <pre><code>var container = new UnityContainer();
  container.RegisterTypes(
  AllClasses.FromLoadedAssemblies(),
  WithMappings.FromAllInterfaces,
  WithName.TypeName,
  WithLifetime.ContainerControlled,null,true);
  config.DependencyResolver = new UnityResolver(container);
  </code></pre>
  
  <p>When I'm using the following, everything works but this is not what I want, as now Assembly A knows the concrete type A, and the whole point is that it won't.</p>
  
  <pre><code>container.RegisterType&lt;IA, A&gt;(new HierarchicalLifetimeManager());
  </code></pre>