How to pass a type as parameter to a constructor when using Unity dependency injection
<p>We use Unity dependency injection. We have a class that needs a type passed to it's constructor.</p>

<pre><code>public interface ITest
{
}

public class Test : ITest
{
    public Test(Type myType)
    {

    }
}
</code></pre>

<p>In the container boostrapper we register our type:</p>

<pre><code>public static IUnityContainer Start()
{
    IUnityContainer container = UnityInversionOfControlContainer.RegisterContainer();

    container.RegisterType&lt;ITest, Test&gt;();

    return container;
}
</code></pre>

<p>we resolve like so:</p>

<pre><code>object actual = container.Resolve&lt;ITest&gt;(new ParameterOverride("myType", typeof(string)));
</code></pre>

<p>this give the following error:</p>

<p>Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = "ITest", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type String cannot be constructed. You must configure the container to supply this value.</p>

<p>At the time of the exception, the container was:</p>

<p>Resolving Test,(none) (mapped from Belastingdienst.Omvormers.Mapper.ITest, (none))
  Resolving parameter "myType" of constructor Test(System.Type myType)
    Resolving System.String,(none)
 ---> System.InvalidOperationException: The type String cannot be constructed. You must configure the container to supply this value.</p>

<p>It appears that unity wants to resolve the type via container, and pass in an instance of the type, but I do need the Type.</p>

<p>Thoughts anyone?</p>