title: Using mvc-mini-profiler with EF 4.0 and Ninject
body: <p>I'm trying to use the new mvc-mini-profiler with my EF4 based app, but I have no idea how to properly get a connection to my destination datasource.</p>
  
  <p>Here's as far as I have gotten.</p>
  
  <pre><code>Func&lt;IMyContainer&gt; createContainer = () =&gt;
  {
      var profiler = MiniProfiler.Current;
  
      if (profiler != null)
      {
          var rootConn = // ????
          var conn = ProfiledDbConnection.Get(rootConn);
          return ObjectContextUtils.CreateObjectContext&lt;MyContainer&gt;(conn);
      }
      else
      {
          return new MyContainer();
      }
  };
  
  kernel.Bind&lt;IMyContainer&gt;().ToMethod(ctx =&gt; createContainer()).InRequestScope();
  </code></pre>
  
  <p>How do I get a connection to an EF container, without the contianer itself?  I would just new-up a SqlConnection, except that the connection string is wrapped in all of the EF junk.</p>