Cool, looking forward to it.
K
On
24/06/2010 6:44 AM, Adam Langley wrote:
Thanks Krzysztof,
I will respond soon with my extended thoughts. I am also working on a
CodeProject article detailing my work and findings as well...
Thanks again
*Adam Langley*
*Senior Developer*
*From:* [email protected]
[mailto:[email protected]] *On Behalf Of
*Krzysztof Kozmic
*Sent:* Wednesday, 23 June 2010 10:07 p.m.
*To:* [email protected]
*Subject:* Re: decomission of transient services in child containers
resolved/configured by a parent
Adam,
That's an interesting scenario. Generally, as I blogged recently,
container hierarchies are a teritory not very well defined, both
implementation wise, and conceptually.
I would be very interested in getting your opinion on it.
What I think, is that probably similar thing should happen as in case
of neseting containers - where releasing nested container, releases
components resolved through it.
I don't know why that's different in case of Container wrappers, to be
honest I never used them so maybe there's a reason for having this
behavior rather than some other? Can you think of such scenario where
nesting containers along with wrappers would not make sense?
And while we're on it - I'd really appreciate if you wanted to
contribute to Windsor's documentation on the topic:
http://stw.castleproject.org/Windsor.MainPage.ashx
Perhaps by writing the docs and puring all your knowledge to paper
will help us crystalize some ideas around this.
Anyone else who is using this functionality - feel free to join the
discussion (and write docs!)
Krzysztof
On 23/06/2010 10:04 AM, Adam Langley wrote:
I am testing a specific use-case for the Windsor ContainerWrapper
which I would like to run past the forum.
The ContainerWrapper is a ComponentModel ServiceContainer - the
essence of its purpose is to provide 'siting' functionality to
components, a sited componed being one that has it's lifecycle managed
(automatic disposal when the owner of the ServiceContainer is
disposed), and provide services to the components directly within.
I have a standard Windows Forms control hierarchy, where by I have
replaced the default 'components' collection with a ContainerWrapper.
These ContainerWrappers are chained through the control-hierarchy so
that a deeply nested UserControl can obtain services from the Form
simply by calling 'GetService'.
Now, this works perfectly, I am just having a small issue with
lifecycle management of services.
Form ContainerWrapper1 UserControl1 ContainerWrapper2 UserControl2
TransientService
| | | | | |
[|] .ctor() | | | | |
[|]---------->[|] .ctor() [|] | | |
[|]-----------[|]-------------->[|] .ctor() | | |
[|] [|] [|]-------------->[|] .ctor() [|] |
[|] [|] [|]---------------[|]--------------->[|] |
[|] [|] [|] [|] GetService [|] |
[|] [|] [|] [|]<---------------[|] |
[|] [|] GetService [|] [|] [|] |
[|] [|]<--------------[|]---------------[|] [|] .ctor() |
[|]
[|]---------------[|]---------------[|]----------------[|]--------------->[|]
[|] [|] [|] [|] [|] [|]
[|] [|] [|] [|] [|] |
[|] [|] [|] [|] | |
[|] [|] [|] | | |
[|] [|] | | | |
[|]
As in the diagram, the form creates the UserControl and sites it
within the ContainerWrapper1, which in turn (InitializeComponent)
creates UserControl2 and sites it within ContainerWrapper2.
These wrappers are chained, but their Kernels are not (this is how the
ContainerWrapper works internally).
When UserControl2 asks for a service, which is configured at the
ContainerWrapper1 level, the call gets promoted (NOT via the Kernel),
from ContainerWrapper2 to ContainerWrapper1.
UserControl2 now has a reference to a transient service.
I have a case where by UserControl1 (and all its child controls) needs
to be removed from Form.Controls collection, and disposed. This is
fine, however ContainerWrapper1 holds the reference to the transient
service (which is owned by the Form), so it is not disposed - even
though the service was requested at the ContainerWrapper2 level....
Does this behaviour make sense? Or should (logically)
ContainerWrapper2 be considered the 'owner' of the disposal policy of
the service, and as such, dispose/release the transient instance?
Thanks
*Adam Langley*
--
You received this message because you are subscribed to the Google
Groups "Castle Project Users" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:[email protected]>.
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.
--
You received this message because you are subscribed to the Google
Groups "Castle Project Users" group.
To post to this group, send email to
[email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.
--
You received this message because you are subscribed to the Google
Groups "Castle Project Users" group.
To post to this group, send email to
[email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Castle
Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.