考虑这个例子:
public class Factory
{
private List<ISubFactory> subFactories;
public Factory(List<ISubFactory> subFactories)
{
this.subFactories = subFactories;
}
}
public interface ISubFactory
{
}
我希望Windsor解析Factory类并将容器中注册的ISubFactory接口的所有实现者(ResolveAll)放入“subFactories”参数中,Windsor可以这样做吗?
答案 0 :(得分:8)
是的,它可以。但是你必须首先选择注册ListResolver
container.Kernel.Resolver.AddSubResolver(new ListResolver(container.Kernel));