How to resolve using different implications using Windsor Castle

I have 2 controllers that depend on ISomeService

public class FirstController
{
    public FirstController(ISomeService someService)
    {
    }
}

public class SecondController
{
    public SecondController(ISomeService someService)
    {
    }
}

ISomeServicehas one implementation, which depends on IRepository:

public class SomeService : ISomeService
{
    public SomeService(IRepository repository)
    {
    }
}

IRepositoryhas 2 implementations: FirstRepositoryand SecondRepository.

How to configure a container for permission FirstControllerusing FirstRepositoryand SecondControllerwith SecondRepository?

+3
source share
1 answer

You can register implementation 2 with different names and then pass the name when calling the Resolve method. http://castleproject.org/container/documentation/trunk/manual/windsortypedocs/Generated_IWindsorContainer.html#IWindsorContainer_Methods5

Mark this section in Windsor docs

+2
source

All Articles