如何解决使用windsor城堡的不同实现

时间:2012-05-13 11:01:25

标签: .net castle-windsor

我有两个依赖于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个实现:FirstRepositorySecondRepository

如何配置容器以使用FirstControllerFirstRepository SecondController来解析SecondRepository

1 个答案:

答案 0 :(得分:2)