1

How do I get a list of all IRegistrations/ComponentRegistrations in my WindsorContainer or its kernel? I can see a way of doing this by wiring to the ComponentRegistered event and tracking there, but is there an eaiser way?

Thanks.

Jeff
  • 35,755
  • 15
  • 108
  • 220

1 Answers1

2

You can get the handlers from the container, but not the IRegistrations:

IHandler[] handlers = container.Kernel.GetAssignableHandlers(typeof(object));

Handlers are basically the registered components. IHandler.ComponentModel contains most of the information of a registered component.

Mauricio Scheffer
  • 98,863
  • 23
  • 192
  • 275
  • 1
    This will give you all handlers for all services registered in the container. If for some reason you are interested in components you have to create a set out of handler's `ComponentModel` properties. – Krzysztof Kozmic Jun 01 '10 at 22:49
  • 1
    Could you clarify what you mean by "create a set out of handler's ComponentModel properties."? Thanks. – Jeff Jun 02 '10 at 13:54
  • 1
    @jeffn825: `container.Kernel.GetAssignableHandlers(typeof(object)).Select(h => h.ComponentModel)` – Mauricio Scheffer Jun 02 '10 at 15:50