I'm trying to do dependency injection in my .NET project (application layer). I have two Base files for the interfaces and the classes. So I put this in my program.cs:
builder.Services.AddScoped(typeof(IAppAnexo), typeof(AppAnexo)); but Im getting 2 errors
InvalidOperationException: Error while validating the service descriptor 'ServiceType: SisPenalidades.Application.Interfaces.IAppAnexo Lifetime: Scoped ImplementationType: SisPenalidades.Application.Services.AppAnexo': Unable to resolve service for type 'SisPenalidades.Application.Interfaces.Base.IApp`1[SisPenalidades.Domain.Entities.Anexo]' while attempting to activate 'SisPenalidades.Application.Services.AppAnexo'.
and
InvalidOperationException: Unable to resolve service for type 'SisPenalidades.Application.Interfaces.Base.IApp`1[SisPenalidades.Domain.Entities.Anexo]' while attempting to activate 'SisPenalidades.Application.Services.AppAnexo'.
What am I doing wrong? I did the same thing on my repository layer and it works, but it doesnt works on the Application layer.
the project structure:

Obs. if i remove the App.cs base class and put their methods direclty on the AppAnexo.cs class, it works
Источник: https://stackoverflow.com/questions/780 ... dd-project
Мобильная версия