0
p.j.keukens created
- ABP Framework version: v7.0.3
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC): yes / no
- Exception message and stack trace:
- An exception was thrown while activating Castle.Proxies.ReferenceDataProxy. Autofac.Core.DependencyResolutionException: An exception was thrown while activating Castle.Proxies.ReferenceDataProxy. ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Castle.Proxies.ReferenceDataProxy' can be invoked with the available services and parameters: Cannot resolve parameter 'ReferenceData.IReferenceDataRepository referenceDataRepository' of constructor 'Void .ctor(Castle.DynamicProxy.IInterceptor[], ReferenceData.IReferenceDataRepository)'.
- Steps to reproduce the issue: Steps to reproduce:
- Have a tiered application using MVC and Ef-Core based on the application template
- Add a module and reference is from the main project
- In the EntityFrameworkCore project of the module add an entity and a repository class
- In the Domain project of the module add an interface
- In the Application module of the module create an AppService where the custom repository is injected
- Some how it cannot resolve the repository and I can't find the problem, if I use IRepository<ReferenceData, string> directly in the AppService that works. But what am I missing that the custom repository isn't registered in the dependency Injection?
Here are the code definitions used:
//Repository in EntityFrameworkCore project of application module
public class EfCoreReferenceDataRepository : EfCoreRepository<ReferenceDbContext, ReferenceData, string>, IReferenceDataRepository
{
public EfCoreReferenceDataRepository(IDbContextProvider<ReferenceDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
}
//Interface in Domain module of application module (Also tried IRepository<ReferenceData, string> also tried adding ITransientDependency)
public interface IReferenceDataRepository : IBasicRepository<ReferenceData, string>
// Dependency injection in AppService of application module
public ReferenceDataAppService(IReferenceDataRepository referenceDataRepository)
In other modules in the project this works fine, these modules have been upgraded from version 6.0.5 to 7.0.3. The module with the problem is added to the application as a new v7.0.3 module.
I do not use: SkipAutoServiceRegistration
Documentation says: Some specific types are registered to dependency injection by default. Examples:
Repositories (implement BasicRepositoryBase class or its subclasses) are registered as transient.
4 Answer(s)
-
0
hi
Can you share the project with me? liming.ma@volosoft.com
-
0
@maliming just send you a freshly created project with the same problem.
-
0
hi
Rename
EfCoreReferenceDataRepository
toEfCoreTempReferenceDataRepository
-
0
Ah yeah, stupid mistake by me... Thanks