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.
It was as if my DataContext instance was being cached... Nothing made sense and I was considering a career move.
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.
So dependency injection was the issue, but I still don't know why. I am speculating that Ninject was caching the injected DataContext.
Is this correct?
Edit:
The Ninject binding is as follows:
Bind<IPupilBlockService>().To<SqlPupilBlockService>()
.WithConstructorArgument("db", new dbDataContext());