2009-01-12 55 views
1

我注册应用我的两个接口开始像这样: -城堡温莎 - 一类实现多个接口

container.Register(Component.For(typeof(IEntityIndexController)).ImplementedBy(typeof(SnippetController)).LifeStyle.Transient); 
container.Register(Component.For(typeof(ISnippetController)).ImplementedBy(typeof(SnippetController)).LifeStyle.Transient); 

然后,当我试图在这里使用第二个接口的对象上运行IoC.Resolve(它会抛出以下异常: -

无法创建组件'MyApp.Admin.Presenters.SnippetPresenter',因为它具有要满足的依赖关系。 MyApp.Admin.Presenters.SnippetPresenter正在等待以下依赖项: 服务: - MyApp.Admin.Controllers.ISnippetController未注册。

如果我切换它周围的注册顺序,它会抱怨它无法找到IEntityIndexController。所以它看起来只会选择一个类的第一个注册,那么映射到同一个具体类的其他接口将被忽略。

这里有什么明显的东西我失踪了吗? (ps.s.im使用.net 3.5,windsor RC3)

回答

4

您是否试过使用不同的语法注册(AddComponent<>)?

尝试更新到最新的中继版本,看看它是否有帮助。对我来说看起来像一个bug。 如果没有发生,创建一个展现该bug的测试,并提交它here

2

更新到最新的主干(1015),并使用转发类型修复了问题。 :-)