2009-01-12 54 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),並使用轉發類型修復了問題。 :-)