title: Translating Ninject to ASP.NET MVC 6 DI
body: <p>I am trying to get into the new ASP.NET MVC 6 stuff, but I'm having a very hard time with their new DI system. I have tried to find resources online, but everything I find covers only the absolute most bare minimum to use it.</p>
  
  <p>I was previously using <code>Ninject</code>, and I have several wire-ups that work like this:</p>
  
  <pre><code>Bind&lt;IDocumentStore&gt;()
      .ToMethod(c =&gt; CreateDocumentStore())
      .InSingletonScope();
  
  private static IDocumentStore CreateDocumentStore() {
      // lots of initialization code, etc.
      return documentStore;
  }
  </code></pre>
  
  <p>But so far I am having a difficult time finding out how to translate this kind of behaviour to Microsoft's new DI system. All I can find are examples like this:</p>
  
  <pre><code>services.AddTransient&lt;IEmailSender, AuthMessageSender&gt;();
  services.AddTransient&lt;ISmsSender, AuthMessageSender&gt;();
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>services.AddMvc();
  </code></pre>
  
  <p>Where everything seems to work entirely on the default constructor for the target service. Is there any way to produce the behaviour I am needing in this new DI system?</p>
  
  <p>I've seen the</p>
  
  <pre><code>services.Configure&lt;TOptions&gt;(options =&gt; {});
  </code></pre>
  
  <p>But I'm not really clear on whether that will do what I am thinking, or if it is reserved for specific behaviours.</p>