views:

67

answers:

1

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

A: 

RTFM :)

And seriously, I have a post about this in my qeueue. I just need to write it.

Rule is:

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).

Krzysztof Koźmic
Thanks Krzysztof. I know you RTFM comment was in jest, but this page http://www.castleproject.org/container/documentation/v1rc3/manual/windsortypedocs/Generated_IWindsorContainer.html just says 'Releases the component instance'!! The API docs could be a little more forthcoming. But thank you for your answer!
David
OMG, I had no idea you have PerWebRequest. I'm glad I RTFM now...
David