Using Castle Windsor configuration files is it pos

2019-07-17 22:13发布

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.

1条回答
Melony?
2楼-- · 2019-07-17 22:20

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.

查看更多
登录 后发表回答