How to manage components registration?

12 views
Skip to first unread message

mynkow

unread,
Sep 16, 2011, 9:23:22 AM9/16/11
to castle-pro...@googlegroups.com
Hi,

I have an Interface with 2 implementations. I can register a service with 1 implementation and switch with the other implementation. The problem is that I can switch implementations between 2 startups of the application. I have an administration part of my application and I wish to change the registered implementation of my service at runtime. How can I do that?

Jason Meckley

unread,
Sep 16, 2011, 3:05:27 PM9/16/11
to castle-pro...@googlegroups.com
Isubdependency resolver and/or Ihandlerselector. both allow you to override how the component would be selected. from the admin module, set a flag that says which component would be selected in your subdependency or handler selector reference that flag and select the appropriate component.

you may even be able to do something with extended propreperties and forgo the subdependency resolver or handler selector altogether. the admin module could configure the extended properties of the component for you.

mynkow

unread,
Sep 19, 2011, 5:07:15 AM9/19/11
to castle-pro...@googlegroups.com
Very nice Mr. Meckley. This is exactly what I want. Thank you.

If someone else is trying the same thing => http://ayende.com/blog/3633/windsor-ihandlerselector

Best regards.

Juanma

unread,
Sep 23, 2011, 8:51:24 AM9/23/11
to castle-pro...@googlegroups.com
I have a sample of how to apply convention based handler selection to achieve something like that.
You can find it in https://github.com/jmhdez/IHandlerSelector-Sample


--
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/-/0KImZDOWhhQJ.

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.

Reply all
Reply to author
Forward
0 new messages