title: Dependency Injection with constructor parameters that aren't interfaces
body: <p>I'm still a newbie at DI, and I am trying to understand if I am thinking of things the wrong way.  I am working on a toy problem when I want to represent a Die object that has a dependency on an IRandomProvider.  That interface is simple:</p>
  
  <pre><code>public interface IRandomProvider 
  {
     int GetRandom(int lower, int upper);
  }
  </code></pre>
  
  <p>I want to have a Die constructor that looks like this:</p>
  
  <pre><code>Die(int numSides, IRandomProvider provider)
  </code></pre>
  
  <p>I'm trying to use a static DIFactory that has a method like this:</p>
  
  <pre><code>    public static T Resolve&lt;T&gt;()
      {
          if (kernel == null)
          {
              CreateKernel();
          }
          return kernel.Get&lt;T&gt;();
      }
  </code></pre>
  
  <p>Where CreateKernel simply binds to a specific implementation of IRandomProvider.</p>
  
  <p>I want to be able to call this with:</p>
  
  <pre><code>DIFactory.Resolve&lt;Die&gt;(20);
  </code></pre>
  
  <p>I can't make this work without making a special version of "Resolve" which can allow me to deal with ConstructorArgs.  That seems to make things overly complex, and would require me to modify DIFactory for every other instance of that, as well as tie to a specific name for the constructor parameter.</p>
  
  <p>If I refactor the Die class to not use the int constructor, everything works fine.  But now someone has to remeber to initialize the numSides parameter, which seems like a bad idea, since it is a requirement for the class.</p>
  
  <p>I suspect this is a bad mental model for DI.  Can anyone enlighten me?</p>