구성 :성 윈저 IOC의 : 서비스 및 저장소 레이어를 초기화하는 방법
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.