title: Ninject caching an injected DataContext? Lifecycle Management?
body: <p>I had a series of very bizarre errors being thrown in my repositories.  Row not found or changed, 1 of 2 updates failed...  Nothing made sense.  </p>
  
  <p>It was as if my DataContext instance was being cached...  Nothing made sense and I was considering a career move.</p>
  
  <p>I then noticed that the DataContext instance was passed in using dependency injection, using Ninject (this is the first time I have used DI...).  I ripped out the Dependency Injection, and all went back to normal.  Instantly.</p>
  
  <p>So dependency injection was the issue, but I still don't know why.  I am speculating that Ninject was caching the injected DataContext.  </p>
  
  <p>Is this correct?  </p>
  
  <h2>Edit:</h2>
  
  <p>The Ninject binding is as follows:</p>
  
  <pre><code>Bind&lt;IPupilBlockService&gt;().To&lt;SqlPupilBlockService&gt;()
     .WithConstructorArgument("db", new dbDataContext());
  </code></pre>