Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't create component as it has dependencies to be satisfied

I am learning DDD, n-Tier, Repositoriess and the likes. Someone pointed me to ASP.NET Boilerplate and I decided to start a test project using that. I have never dealt with dependency injection so this is all new to me, but the DI dependency it uses ius Castle Windsor. Now, I created a Model and from this Model I created an interface. I also added a Service. Whenever I fire up the app it gives me this error:

Can't create component 'TestApp.Services.MemberInfo.MemberAppService'
as it has dependencies to be satisfied.

'TestApp.Services.MemberInfo.MemberAppService' is waiting for the following dependencies:
- Service 'TestApp.Repositories.IMemberInfoRepository' which was not registered.

I know you've got to register services and the likes, but reading ABPs documentation it says here, http://www.aspnetboilerplate.com/Pages/Documents/Dependency-Injection#DocAbpInfrastructure, that they are registered automatically if you add App to the name of the class. Basically, this is my code:

IMemberInfoRepository

    public interface IMemberInfoRepository : IRepository<MemberInfo, Guid>
{

}

MemberAppService

 public class MemberAppService : IMemberAppService
{
    private readonly Repositories.IMemberInfoRepository _memberInfoRepository;

    public MemberAppService(Repositories.IMemberInfoRepository memberInfoRepository)
    {
        _memberInfoRepository = memberInfoRepository;
    }

    public void Create(MemberInfoDto input)
    {
      _memberInfoRepository.Insert(AutoMapper.Mapper.Map<m.MemberInfo>(input));
    }

IMemberAppService

public interface IMemberAppService :IApplicationService
{
    void Create(MemberInfoDto input);
}

So, here I am. Stuck. I read some Castle Windsor official documentation but as this is my first rodeo with this I am stuck at on what to do. Anything else would be greatly appreciated.

like image 526
Lord Relix Avatar asked Sep 03 '15 01:09

Lord Relix


1 Answers

I had the same problem but I could solve it!

This is a screenshot of the error given by IIS.

The reason of the error is that ABP cannot find the defined entity class Member.

The solution was to add the code public virtual IDbSet<Members> Members { set; get; }in the DbContext of the EntityFramework Project.

like image 191
Farb Avatar answered Oct 20 '22 10:10

Farb