0
component id="customerService" service="MyApp.ServiceLayer.ICustomerService`1[[MyApp.DataAccess.Customer, MyApp.DataAccess]], MyApp.ServiceLayer" type="MyApp.ServiceLayer.CustomerService, MyApp.ServiceLayer"
控制器:
private ICustomerService _service;
public CustomerController()
{
WindsorContainer container = new WindsorContainer(new XmlInterpreter());
_service = container.Resolve>("customerService");
}
服務層:
private ICustomerRepository _repository;
public CustomerService(ICustomerRepository repository)
{
_repository = repository;
}
錯誤:
Can't create component 'customerService' as it has dependencies to be satisfied. customerService is waiting for the following dependencies: Services: - MyApp.Repository.ICustomerRepository`1[[MyApp.DataAccess.Customer, MyApp.DataAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] which was not registered.