title: ASP.NET 5 dependency injection outside of Controllers and Views
body: <p>Each tutorial or example that I've found for using DI in ASP.NET 5 only shows how it works with Controllers and Razor Views.  I need to use DI for other classes but don't know the proper way to resolve types and provide an instance.  Right now I have an instance of a <code>HackyDependencyResolver</code> that everything must reference in order to get the proper instances.  I want to either access ASP.NET's service resolver or follow some other best-practice for resolving dependencies. </p>
  
  <p>For example if I have</p>
  
  <pre><code>public class SomeClass
  {
    public SomeClass(IUseMe useMe)
    {
    }
  }
  </code></pre>
  
  <p>which is not an ASP.NET MVC Controller.  I need a pattern for resolving a correct instance for <code>IUseMe</code> when <code>SomeClass</code> is created.  Certainly I can make my own global factory, but is that the best way?</p>