温莎城堡 - 一类实现多个接口
-
22-07-2019 - |
题
我寄存器上应用我的两个接口开始像这样: -
container.Register(Component.For(typeof(IEntityIndexController)).ImplementedBy(typeof(SnippetController)).LifeStyle.Transient);
container.Register(Component.For(typeof(ISnippetController)).ImplementedBy(typeof(SnippetController)).LifeStyle.Transient);
然后,当我试图在这里使用第二接口的对象上运行IoC.Resolve(ISnippetController)它引发以下例外: -
无法创建组件“MyApp.Admin.Presenters.SnippetPresenter”,因为它具有的依赖关系被满足。 MyApp.Admin.Presenters.SnippetPresenter正在等待以下依存关系: 服务: - 其中未注册MyApp.Admin.Controllers.ISnippetController
如果我切换登记的顺序围绕它抱怨找不到IEntityIndexController。所以会出现它只拾取类的第一个登记,那么任何进一步的接口,其映射到相同的具体类被忽略。
有什么明显的在这里,我失踪? (使用.NET 3.5 P.S. IM,温莎RC3)
解决方案
您是否尝试过用不同的语法(AddComponent<>
)?
尝试更新到最新的商业版本,并看看是否有帮助。看起来像我的错误。 如果它不发生,创建一个测试表现出了错误,并提交这里
其他提示
更新为最新的躯干(977),并用于转发类型的固定的问题。 : - )
不隶属于 StackOverflow