2

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.

4

1 回答 1

2

您正在寻找的是我相信的转发类型......看看这些问题:

虽然目前在 xml 配置中不支持开箱即用,但第二个问题有一个答案,详细说明了如何通过编写一个简单的工具来做到这一点。

于 2008-12-08T17:07:09.007 回答