Re: Windsor: is it ok to release components after creation with Typed Factory? (from stackoverflow)

27 views
Skip to first unread message

Krzysztof Kozmic

unread,
Nov 14, 2012, 8:07:41 PM11/14/12
to castle-pro...@googlegroups.com
typed factory won't currently release collection of object, just individual objects.

Releasing an object doesn't mean the entire graph will be released. Lifestyle of each individual leaf in the graph is taken into account so it is generally safe to call release anytime you're done using the root object of the graph.

-- 
Krzysztof Kozmic

On Thursday, 15 November 2012 at 11:02 AM, Michael S. wrote:

I'm impressed how quickly I found help here and want to ask another question. Acutally it was posted on http://stackoverflow.com/questions/13372142/castle-windsor-is-it-ok-to-release-components-after-creation-with-typed-factory
The scenario is to allocate a collection of objects created by typed factory, do some work not involving objects directly (write database), use objects in the collection (make web-service calls by means of those objects) and release them. I experience difficulties with releasing the collection of objects safely. Does typed factory support releasing a collection/array of components? Or what may happen if I release component right after I create it and the component has other components injected?

--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/castle-project-users/-/6tSZNIg7nyEJ.
To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.

Michael S.

unread,
Nov 14, 2012, 8:23:53 PM11/14/12
to castle-pro...@googlegroups.com
Got it. And vice versa: it's generally unsafe to release object before it's going to be used, right?
To unsubscribe from this group, send email to castle-project-users+unsub...@googlegroups.com.

Krzysztof Kozmic

unread,
Nov 14, 2012, 8:29:01 PM11/14/12
to castle-pro...@googlegroups.com
yes,

releasing an object is like returning a rental car. It's stating "hey, I don't need that object anymore, do as you please with it
"

-- 
Krzysztof Kozmic


To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages