question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Repository

See original GitHub issue

Hi,

I cannot make custom repository work, please help:

I try to make OneRepositoryBase the reference repository but it always fails at startup, see attached project. MyProject.zip

here is the error:

An error occurred while starting the application. ArgumentException: Target does not implement interface Abp.Domain.Repositories.IRepository1[[Abp.Localization.ApplicationLanguage, Abp.Zero.Common, Version=3.6.1.0, Culture=neutral, PublicKeyToken=null]] Parameter name: target Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTarget(Type interfaceToProxy, Type[] additionalInterfacesToProxy, object target, ProxyGenerationOptions options, IInterceptor[] interceptors) ComponentActivatorException: ComponentActivator: could not proxy MyProject.EntityFrameworkCore.MainRepository1[[Abp.Localization.ApplicationLanguage, Abp.Zero.Common, Version=3.6.1.0, Culture=neutral, PublicKeyToken=null]] Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments) ArgumentException: Target does not implement interface Abp.Domain.Repositories.IRepository`1[[Abp.Localization.ApplicationLanguage, Abp.Zero.Common, Version=3.6.1.0, Culture=neutral, PublicKeyToken=null]] Parameter name: target Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTarget(Type interfaceToProxy, Type[] additionalInterfacesToProxy, object target, ProxyGenerationOptions options, IInterceptor[] interceptors) Castle.Windsor.Proxy.DefaultProxyFactory.Create(IKernel kernel, object target, ComponentModel model, CreationContext context, Object[] constructorArguments) Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments)

related to #2280, but I used the template

  • Your Abp package version: 3.6.1
  • Your base framework: .Net Core.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
acjhcommented, Jun 23, 2018

You’re welcome. I submitted a PR to make RepositoryBase implement IRepository<TEntity>. The abstract declaration is intended for developers to create (multiple) concrete subclasses.

0reactions
renatoguarilhacommented, Jun 23, 2018

My apologies, you was right. Somehow the template was created with some mistakes.

protected abstract class ProvizoCoreRepositoryBase<TEntity> : ProvizoCoreRepositoryBase<TEntity, int> where TEntity : class, IEntity<int> { protected ProvizoCoreRepositoryBase(IDbContextProvider<ProvizoCoreDbContext> dbContextProvider) : base(dbContextProvider) { } }

As you said all the time, it should be like: public class ProvizoCoreRepositoryBase<TEntity> : ProvizoCoreRepositoryBase<TEntity, int>, IRepository<TEntity> where TEntity : class, IEntity<int> { public ProvizoCoreRepositoryBase(IDbContextProvider<ProvizoCoreDbContext> dbContextProvider) : base(dbContextProvider) { } }

Thank you for your time, and my apologies one more time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

1. Working with Spring Data Repositories
Spring Data repositories easily allow you to provide custom repository code and integrate it with generic CRUD abstraction and query method functionality.
Read more >
The best way to write a custom Spring Data Repository
Learn the best way to write a custom Spring Data Repository that provides additional data access query and update methods.
Read more >
Spring Data Composable Repositories
Custom Repositories. If required, we can enrich our model repository by writing a fragment interface and implementing the desired functionality.
Read more >
Custom Repository in Spring Data JPA | by Thành Trần
The class design diagram above indicates how we can create a custom repository in Spring Data JPA. We just need to let EmployeeRepository...
Read more >
Add Custom Functionality to a Spring Data Repository
Take a look at how Spring Data allows us to add custom methods to a Spring Data Repository, complete with plenty of code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found