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

2

10

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.

Uund answered 3/9, 2015 at 1:0 Comment(1)
The linked documentation suggests you should call IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); "to [tell] ASP.NET Boilerplate to register your assembly by convention"Orthogenetic
O
14

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.

Osher answered 4/12, 2015 at 7:29 Comment(0)
B
0

after my workmate updated one ABP version, I met the same error. I checked my old code. found that, he missed to attach one cs file to the project. then I recoved it, now it works. please check whether you have similar file in the same path, wish it can help you.

[EF project]\EntityFramework\Repositories\xxxxRepository.cs

if you did not have, please create a similar one as xxxxRepositoryBase.cs

Batey answered 20/5, 2016 at 5:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.