Base solution for your next web application
Open Closed

Can't create component #1557


User avatar
0
jamsecgmbh created

Hi,

I have a problem with a service I have added - unfortunately I have not chosen the correct naming convention while creating it, I missed to name it ...AppService, just named it ...Service. I read in your article about Dependency Injection that automatic registrations can only work if everything is named correct. I renamed it, but I can't get it to work (I have already implemented other ones without problems). I get the following exception:

"Can't create component 'MyDatabase.Infosheets.InfosheetAppService' as it has dependencies to be satisfied.

'MyDatabase.Infosheets.InfosheetAppService' is waiting for the following dependencies:
- Service 'Abp.Domain.Repositories.IRepository`2[[MyDatabase.Infosheets.RequestInfosheet, MyDatabase.Core, Version=1.10.0.0, Culture=neutral, PublicKeyToken=null],[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' which was not registered.
"
exceptionType
:
"Castle.MicroKernel.Handlers.HandlerException"

Could you please help me?


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Your problem is not related to AppService, it's related to your IRepository<RequestInfosheet>.

    Can you share your RequestInfosheet entity ?

  • User Avatar
    0
    jamsecgmbh created
    using Abp.Domain.Entities;
    using Abp.Domain.Entities.Auditing;
    using MyDatabase.JobRequests;
    using System.ComponentModel.DataAnnotations.Schema;
    
    namespace MyDatabase.Infosheets
    {
        [Table("CdbJobsInfosheets")]
        public class RequestInfosheet : FullAuditedEntity<long>, IMustHaveTenant
        {
            [ForeignKey("JobRequestId")]
            public virtual JobRequest JobRequest { get; set; }
            public virtual long JobRequestId { get; set; }
    
            public virtual long InfosheetSourceId { get; set; }
    
            public virtual string InfosheetName { get; set; }
    
            public virtual int TenantId { get; set; }
    
            public RequestInfosheet()
            {
    
            }
        }
    }
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    It seems ok. Did you add it to your DbContext ?

  • User Avatar
    0
    jamsecgmbh created

    What a stupid mistake! I am very sorry for stealing your time! Thank you very much!

  • User Avatar
    0
    ismcagdas created
    Support Team

    No problem at all :)