A cleaner (and possibly clearer) way to achieve an override ability is to
use a custom IHandlerSelector, in which you can pick an override if it
exist.

Ken Egozi.
http://kenegozi.com/ <http://kenegozi.com/blog>

On Thu, Oct 13, 2016 at 11:21 PM, BhaaL DoesNotUseGplus <bhaal...@gmail.com>
wrote:

> Since I'm probably not going to find the time to actually implement this
> soon-ish, I'll post my current findings here (so I can remember what I
> already tried; or maybe someone else can pick it up from there).
>
> For whatever reason, the "first one wins" idea doesn't apply to named
> components/services as soon as they come from different sources.
> However, there is a way of making this work by calling
> ComponentRegistration.RegisterOptionally
> <https://github.com/castleproject/Windsor/blob/master/src/Castle.Windsor/MicroKernel/Registration/ComponentRegistration.cs#L1064>
> - which unfortunately is internal.
>
> Using Reflection (which is a PITA to maintain since we'd depend on
> implementation details), I can actually call that method to make certain
> specific named components/services overridable; and achieve my desired
> result:
> - the App.config registers a named service that should be used instead
> - the hardcoded named service from the Installer class is ignored
>
> The goal would/could be to package this into some sort of Facility, so we
> don't have to dirty-hack around with implementation details; but at the
> same time, the Facility would face the same issue (unless it were part of
> Windsor).
>
> I'll just leave it at that for now; but if anyone has some good reasons
> against doing it this way, please speak up.
> Otherwise, thanks for reading.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to castle-project-users+unsubscr...@googlegroups.com.
> To post to this group, send email to castle-project-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to