我有代码(简化)
配置:
_container.AddComponent<IRepository<Project>, FakeProjectRepository>();
var instance = new List<Project>();
_container.Kernel.AddComponentInstance<IList<Project>>(instance);
类别:
class FakeProjectRepository: IRepository<Project>
public FakeProjectRepository(IList<Project> entities)
{
_entities = entities.ToList();
}
解析container.Resolve(repositoryType)时抛出
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.