我有以下课程:
class Repository : IRepository
class ReadOnlyRepository : Repository
abstract class Command
abstract CommandImpl : Command
{
public CommandImpl(Repository repository){}
}
class Service
{
public Service (Command[] commands){}
}
我在代码中注册它们如下:
var container = new Container("WindsorCOntainer.config");
var container = new WindsorContainer(new XmlInterpreter("WindsorConfig.xml"));
container.Kernel.Resolver.AddSubResolver(new ArrayResolver(container.Kernel));
container.AddComponent("repository", typeof(RentServiceRepository));
container.Resolve<RentServiceRepository>();
container.AddComponent("command", typeof(COmmandImpl));
container.AddComponent("rentService", typeof (RentService));
container.Resolve<RentService>(); // Fails here
我收到“RentService 正在等待依赖命令”的消息
我究竟做错了什么?
谢谢,