title: Understanding Ninject mvc 3 boiler plate code
body: <p>If you install the nuget Ninject package for mvc, it puts a <code>NinjectWebCommon.cs</code> file in the App_Start folder. </p>
  
  <p>I understand 99% of the stuff in this file apart from this line:</p>
  
  <pre><code>kernel.Bind&lt;Func&lt;IKernel&gt;&gt;().ToMethod(ctx =&gt; () =&gt; new Bootstrapper().Kernel);
  </code></pre>
  
  <p>Full code file <a href="https://github.com/ninject/Ninject.Web.Common/blob/master/nuget-webhost/Content/App_Start/NinjectWebCommon.cs.pp">here on GitHub</a></p>
  
  <p>In my mind, it would be better to use:</p>
  
  <pre><code>kernel.Bind&lt;Func&lt;IKernel&gt;&gt;().ToMethod(ctx =&gt; () =&gt; bootstrapper.Kernel);
  </code></pre>
  
  <p>As the static instance is already defined at the top of the file, and thus it will get the kernal that has all the mappings built.</p>
  
  <p>After some googling it seems this is also common:</p>
  
  <pre><code>kernel.Bind&lt;Func&lt;IKernel&gt;&gt;().ToMethod(ctx =&gt; () =&gt; ctx.Kernel);
  </code></pre>
  
  <p>What is the reasoning behind the way the boilerplate code is the way it is? </p>