I’m injecting my EF context using Ninject using an ‘InThreadScope’. This works fabulously except for if an exception occurs on the context. This makes the context stale and causes ALL subsequent jobs on the same worker # to also fail (As they run in the same thread).
Is there a recommended way to handle such a situation? Or is it best to just dispose my context at the end of each job to force Ninject to spawn a new one?
Alternatively if there is a way to force each worker to run in a fresh thread for each job. This would resolve this (and any other thread specific issues) in the future.