I have some "caching" objects in my application, that get a IRepository
(custom repository pattern contract) by dependency injection (Ninject). Those objects only uses the repository once, but they have a Refresh function that forces the owner to refresh itself. They are singletons, are created only once, and a ManualResetEvent
ensures that all requests are blocked till it is loaded.
The IRepositories
are EF CodeFirst based, so is it OK just to simply ensure the connection is closed and keep the reference to the DbContext
there forever?
I have disabled the proxies and the lazy loading, so... is OK to have long references from the root of the caching object to hundreds of these cached POCO entities?
Cheers.