Ninject and DataContext disposal

Posted by Bas on Stack Overflow See other posts from Stack Overflow or by Bas
Published on 2010-06-03T09:30:32Z Indexed on 2010/06/03 9:34 UTC
Read the original article Hit count: 383

I'm using Ninject to retrieve my DataContext from the kernel and I was wondering if Ninject automatically disposes the DataContext, or how he handles the dispose() behaviour. From own experiences I know disposing the datacontext is pretty important and that whenever you create a direct object of the DataContext (as in: new DataContext()) you should use a using() block.

My question thus is: When im retrieving my DataContext from the kernel, should I still have to use a using() block? Or does Ninject fix this for me?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ioc-container