When I have resolved a component using container.Resolve(), and I have finished using it, should I call Release()?
At the moment I call Dispose on any IDisposable that the container has got for me. Should I not call Dispose() on the object, but instead call Release() on the container instead? Does it do the same thing?
Thanks
David
Short answer:
Release
what you Resolve
(explicitly, or implicitly - via typed factory)Dispose
what you create and own. (and you don't own what container creates, so don't dispose it - container will).Long answer: I wrote a blogpost going into more details
The documentation on lifestyles goes into more depth as well