abp icon indicating copy to clipboard operation
abp copied to clipboard

Cannot resolve CustomRepository

Open cephaspad opened this issue 3 years ago • 2 comments

I created new project according to https://docs.abp.io/en/abp/latest/Best-Practices/Repositories. But it do not work. Because it shows error Cannot resolve parameter 'Tester.People.IPersonRepository personRepository' of constructor 'Void .ctor(Castle.DynamicProxy.IInterceptor[], Tester.People.IPersonRepository)'.

  • ABP Framework version: 5.3.4
  • Interface: Blazor
  • Database provider: EF Core
  • Exception message and stack trace if available (check the logs).

 Autofac.Core.DependencyResolutionException : An exception was thrown while activating Castle.Proxies.PeopleServiceProxy.
---- Autofac.Core.DependencyResolutionException : None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Castle.Proxies.PeopleServiceProxy' can be invoked with the available services and parameters:
Cannot resolve parameter 'Tester.People.IPersonRepository personRepository' of constructor 'Void .ctor(Castle.DynamicProxy.IInterceptor[], Tester.People.IPersonRepository)'.
  • Steps needed to reproduce the problem.

Run tests

Sample project: tester01.zip

Please help me

cephaspad avatar Sep 09 '22 05:09 cephaspad

I have the same issue. Tried everything https://stackoverflow.com/questions/73768528/dependency-not-injecting-while-using-addrepositories-abp-framework6-0-c-shar

amanadlakha1 avatar Sep 19 '22 05:09 amanadlakha1

The same


From: Aman Adlakha @.> Sent: Monday, September 19, 2022 12:21:52 PM To: abpframework/abp @.> Cc: Cephas PAD @.>; Mention @.> Subject: Re: [abpframework/abp] Cannot resolve CustomRepository (Issue #13979)

@cephaspadhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcephaspad&data=05%7C01%7C%7C5580948e2759424cb25108da99fedc98%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637991617160848201%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=VAfPxkLHh0PGmdkHVZKDx5rDa1wHMQ8PhGT%2FEW%2BnRhI%3D&reserved=0 Is it working fine in the main repository not in the test one?

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fabpframework%2Fabp%2Fissues%2F13979%23issuecomment-1250582275&data=05%7C01%7C%7C5580948e2759424cb25108da99fedc98%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637991617160848201%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=YfULzvUDLy%2FpK60auoyEP9PpIqyX%2BURbCvHI8n3HW9g%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFLAWVF5I3EVASKECKKHZQ3V67Z7BANCNFSM6AAAAAAQILPD6I&data=05%7C01%7C%7C5580948e2759424cb25108da99fedc98%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637991617160848201%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=SSytj7DRjMowseOuPfAa1n6MN9W1rDn3ZBgvkkuJTa8%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

cephaspad avatar Sep 19 '22 07:09 cephaspad

Rename PersonEfCoreRepository class name to EfCorePersonRepository

maliming avatar Sep 25 '22 07:09 maliming

Can i know the reason why this works?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: maliming @.> Sent: Sunday, September 25, 2022 12:55:45 PM To: abpframework/abp @.> Cc: Aman Adlakha @.>; Comment @.> Subject: Re: [abpframework/abp] Cannot resolve CustomRepository (Issue #13979)

Rename PersonEfCoreRepository class name to EfCorePersonRepository

— Reply to this email directly, view it on GitHubhttps://github.com/abpframework/abp/issues/13979#issuecomment-1257138220, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AY3533YKBRC4CENQQFRKSJ3V7747TANCNFSM6AAAAAAQILPD6I. You are receiving this because you commented.Message ID: @.***>

amanadlakha1 avatar Sep 25 '22 08:09 amanadlakha1

hi

https://docs.abp.io/en/abp/latest/Dependency-Injection#exposed-services-by-convention

maliming avatar Sep 25 '22 08:09 maliming

Can i know the reason why this works? Get Outlook for Androidhttps://aka.ms/AAb9ysg ________________________________ From: maliming @.> Sent: Sunday, September 25, 2022 12:55:45 PM To: abpframework/abp @.> Cc: Aman Adlakha @.>; Comment @.> Subject: Re: [abpframework/abp] Cannot resolve CustomRepository (Issue #13979) Rename PersonEfCoreRepository class name to EfCorePersonRepository — Reply to this email directly, view it on GitHub<#13979 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AY3533YKBRC4CENQQFRKSJ3V7747TANCNFSM6AAAAAAQILPD6I. You are receiving this because you commented.Message ID: @.***>

I don't exactly know the reason. I just rename from PersonEfCoreRepository to EfCorePersonRepository . I've read on @maliming link but none of related was found.

cephaspad avatar Sep 25 '22 08:09 cephaspad

naming convention.

The code will check if class.Name.EndsWith(interfaceName.RemoveLeft('I'))

maliming avatar Sep 25 '22 09:09 maliming