9

私はDDD、n-Tier、Repositoriessなどを学んでいます。誰かが ASP.NET Boilerplate を教えてくれたので、それを使ってテスト プロジェクトを開始することにしました。私は依存性注入を扱ったことがないので、これはすべて新しいことですが、DI 依存性は ius Castle Windsor を使用します。ここで、モデルを作成し、このモデルからインターフェイスを作成しました。サービスも追加しました。アプリを起動するたびに、次のエラーが表示されます。

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.

サービスなどを登録する必要があることは知っていますが、ABP のドキュメントを読むと、http: //www.aspnetboilerplate.com/Pages/Documents/Dependency-Injection#DocAbpInfrastructure で、アプリを追加すると自動的に登録されることがわかります。クラスの名前に。基本的に、これは私のコードです:

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);
}

だから、ここにいます。立ち往生。Castle Windsor の公式ドキュメントをいくつか読みましたが、これが初めてのロデオであるため、どうすればよいか困っています。それ以外は大歓迎です。

4

2 に答える 2

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.

于 2015-12-04T07:29:16.360 に答える