views:

178

answers:

1

Using Castle-Windsor, is it possible to declare a type once and use this declaration for multiple Ids rather than writing it out in full each time.

E.g. we have class Widget that implements IFoo and we want the keys "IFoo.A" and "IFoo.B" to get a Widget from Castle. I want to do something like

<id="IFoo.Main"
 type="IFoo"
 service="Widget"/>

then

<id="IFoo.A"
 giveme="IFoo.Main/>

<id="IFoo.B"
 giveme="IFoo.Main/>

Thanks.

+2  A: 

What your are looking for is forwarded types I believe... take a look at these questions:

Though not supported out of the box in xml config at the moment the second question has an answer that details how to do this by writing a simple facility.

Bittercoder