我已经研究了Castle Windsor文档和stackoverflow中的现有主题,关于使用这个容器的依赖项解析,但我仍然不知道它是否可能(如果是,那么如何解决?):
1)注册接口的几个实现,例如:
container.Register(Component.For<IWait<IWebDriver>>().UsingFactoryMethod(ctx => SmallWait));
container.Register(Component.For<IWait<IWebDriver>>().UsingFactoryMethod(ctx => MediumWait));
container.Register(Component.For<IWait<IWebDriver>>().UsingFactoryMethod(ctx => LongWait));`
只需通过ResolveAll解析或在构造函数参数或IEnumerable<T>的字段中自动接收即可。
2)从容器中删除组件的注册?
发布于 2016-11-21 11:15:08
虽然不支持通过.Named().
https://stackoverflow.com/questions/40705167
复制相似问题