Again and again on Castle and lifecycle
You can find at this subversion repository ( http://nablasoft.googlecode.com/svn/trunk/Castle/TestIOC ) a simple project that contains a custom lifecycle that bound the lifecycle of objects to a context. This lifecycle was created to address the problem of disposing inner object, you can find the deails here. This new version support both singleton and transient objects, this a sample test.
|
|
This test shows that an object with singletonContext custom lifecycle is singleton inside a context, and when the context ends all it gets disposed and all the inner references are disposed too. This lifecycle has the main purpose of estabilishing a context that once ended dispose every object created inside the context itself.
The code is still experimental, but it can be a viable solution.
Alk.