This represents a summary of options for the issues raised in Design questions for resolution of IOC-ISSUE-161 in the users list.
First, I want to define a few terms.
Windsor is using the IHandler abstraction to manage all the construction and management related tasks for a single component.
Managing set of handlers is the responsability of the naming sub system and the entire thing is orchestrated as part of the kernel.
The scenario that came up in the users list is WCF integration.
In this case, it seems like we can simply scan the list of registered services and load that into Windsor using some sort of a custom handler.
This is all static resolution, without needing to do much for us.
One key aspect of the way that Windsor works is that it will not perform external dependency resolution.
That is, Windsor doesn't have any way of asking, at the time of resolution, whatever a component is valid or not (custom parameters aside).
This is done so we can perform as much of the work upfront, vs. having to do it at the time of resolution.
Going to the MEF scenario, let us say we have this:
class FooService(IUserRepository ..)
And we register that in the container. The IUserRepository is not registered, so FooService is marked as WaitingDependency.
Let us assume further that we have a MEF catalog that can provide that dependency and that we have a MefHandler that can create instances from a MEF catalog.
In order to cleanly integrate that with Windsor, it is not enough that we join the MEF catalog to Windsor. We would have to register all the exports inside the catalog in Windsor as handler, since that is the only way Windsor will mark waiting dependencies as valid.
We would also need to keep track of changes in the catalog (possible with the ExportsChanged event) and refresh them when they change.
Basically, we have two different choices. Forwarding handlers, which would delegate their responsibilities to an external provider, are very easy to build.
Integrating a catalog, however, is a more complex task, since Windsor makes the assumption that it is managing the entire set.
We can deal with that by basically duplicating a catalog inside Windsor.
I don't like it very much, to tell you the truth.
A better option is to avoid the entire question and change INamingSubsystem so that we can provide external feedback to it. This would mean that we would still need IHandler abstraction, but it wouldn't be managed by Windsor directly.
The only requirement that we have at that point is that we would need to invoke HandlerRegistered for each component in the catalog that has changed.
Thoughts?