views:

33

answers:

1

I have code (simplified)

Configuration:

_container.AddComponent<IRepository<Project>, FakeProjectRepository>();
var instance = new List<Project>();
_container.Kernel.AddComponentInstance<IList<Project>>(instance);

Class:

class FakeProjectRepository: IRepository<Project>
public FakeProjectRepository(IList<Project> entities)
    {
        _entities = entities.ToList();
    }

While resolving container.Resolve(repositoryType) throws

Can't create component 'Domain.Concrete.FakeRepositories.FakeProjectRepository' 
as it  has dependencies to be satisfied. 

Domain.Concrete.FakeRepositories.FakeProjectRepository
is waiting for the following dependencies: 

Keys (components with specific keys)
- entities which was not registered.
A: 

Lists are usually not treated as stand-alone services, but as service overrides or parameters. See the Windsor FAQ and the Windsor documentation on Resolvers.

Mauricio Scheffer