我有 2 个控制器依赖于ISomeService
public class FirstController
{
public FirstController(ISomeService someService)
{
}
}
public class SecondController
{
public SecondController(ISomeService someService)
{
}
}
ISomeService
有一个实现,这取决于IRepository
:
public class SomeService : ISomeService
{
public SomeService(IRepository repository)
{
}
}
IRepository
有 2 个实现:FirstRepository
和SecondRepository
.
如何配置容器以解决FirstController
withFirstRepository
和SecondController
with SecondRepository
?