title: Inject dependency on both a registered type and a concrete object into a constructor with Unity
body: <p>I have a class <code>MyClass</code> with the following constructor:</p>
  
  <pre><code>public MyClass(IRepository repository, AnotherClass anObject) { ... }
  </code></pre>
  
  <p>The interface <code>IRepository</code> is registered at application startup with Unity 2 to be mapped to a concrete class:</p>
  
  <pre><code>IUnityContainer container = new UnityContainer();
  container.RegisterType&lt;IRepository, MyConcreteRepository&gt;();
  </code></pre>
  
  <p>Now, the concrete instance of the second parameter of the constructor is always different depending on application context. So I cannot register <code>AnotherClass</code> to be a specific instance at startup nor does it make sense to let Unity create an object of that class with its default constructor which would happen if I call:</p>
  
  <pre><code>container.Resolve&lt;MyClass&gt;()
  </code></pre>
  
  <p>This resolves to <code>new MyClass(new MyConcreteRepository(), new AnotherClass())</code>.</p>
  
  <p>What I am looking for, if I have some given concrete object <code>anObject</code> of type <code>AnotherClass</code>, is a way to tell Unity to resolve <code>MyClass</code> to</p>
  
  <pre><code>new MyClass(new MyConcreteRepository(), anObject)
  </code></pre>
  
  <p>without permanently registering the instance <code>anObject</code> in the container.</p>
  
  <p>Is this possible and how?</p>
  
  <p>Thank you for help in advance!</p>