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.

Problem using AutoRepositoryTypes

See original GitHub issue

Hi @hikalkan,

Me again 😃!

I trying use AutoRepositoryTypes annotation in my DbContext, but when I do it, get an exeption:

Code:

 [AutoRepositoryTypes(
           typeof(IRepository<>),
           typeof(IRepository<,>),
           typeof(ClinAppsRepositoryBase<>),
           typeof(ClinAppsRepositoryBase<,>)
           )]
    public class ClinAppsDbContext : AbpZeroDbContext<Tenant, Role, User>
    {

Exception:

Erro de Servidor no Aplicativo '/ClinSite'.

Can not instantiate proxy of class: Clintech.ClinApps.Repositories.Repositories.ClinAppsRepositoryBase`1[[Abp.Localization.ApplicationLanguage, Abp.Zero, Version=0.8.3.0, Culture=neutral, PublicKeyToken=null]].
Could not find a parameterless constructor.

Descrição: Ocorreu uma exceção sem tratamento durante a execução da atual solicitação da Web. Examine o rastreamento de pilha para obter mais informações sobre o erro e onde foi originado no código. 

Detalhes da Exceção: Castle.DynamicProxy.InvalidProxyConstructorArgumentsException: Can not instantiate proxy of class: Clintech.ClinApps.Repositories.Repositories.ClinAppsRepositoryBase`1[[Abp.Localization.ApplicationLanguage, Abp.Zero, Version=0.8.3.0, Culture=neutral, PublicKeyToken=null]].
Could not find a parameterless constructor.

Erro de Origem: 


Linha 10:         {
Linha 11:             AbpBootstrapper.IocManager.IocContainer.AddFacility<LoggingFacility>(f => f.UseLog4Net().WithConfig("log4net.config"));
Linha 12:             base.Application_Start(sender, e);
Linha 13:         }
Linha 14:     }

Arquivo de Origem: D:\Projetos\Pessoal\Consultoria Ortoclin\ClinApps\Source\Develop\Clintech.ClinApps\Clintech.ClinApps.ClinSite\Global.asax.cs    Linha: 12 

Rastreamento de Pilha: 


[InvalidProxyConstructorArgumentsException: Can not instantiate proxy of class: Clintech.ClinApps.Repositories.Repositories.ClinAppsRepositoryBase`1[[Abp.Localization.ApplicationLanguage, Abp.Zero, Version=0.8.3.0, Culture=neutral, PublicKeyToken=null]].
Could not find a parameterless constructor.]
   Castle.DynamicProxy.ProxyGenerator.CreateClassProxyInstance(Type proxyType, List`1 proxyArguments, Type classToProxy, Object[] constructorArguments) +352
   Castle.Windsor.Proxy.DefaultProxyFactory.Create(IKernel kernel, Object target, ComponentModel model, CreationContext context, Object[] constructorArguments) +707
   Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments) +366

I changed module-zero template structure, basically separating interfaces from implementation in different projects. If you need see my project: https://github.com/thiagoburgo/abp-initial-sample

Thanks,

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
prateek14commented, Jun 1, 2017

nevermind, figured out the issue constructor was protected

0reactions
hawkpglcommented, Apr 6, 2018

@prateek14 just saved me a lot of time. When inheriting from RepositoryBase, if you resolve the constructor, it gets created as protected. Thanks for leaving your comment here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AutoRepositoryTypes dont working #3312
Hi,. I read the documentation and add my BaseRepository to my DbContext [AutoRepositoryTypes( typeof(IRepository<>), typeof(IRepository<,>), ...
Read more >
How ABP generate IRepository<TEntity> for Entity
The magic is in EfGenericRepositoryRegistrar.cs where: foreach (var entityTypeInfo in _dbContextEntityFinder.
Read more >
Default Repositories
Default Repositories. In ASP.NET Boilerplate, repository classes implement the IRepository<TEntity, TPrimaryKey> interface. ABP can automatically create default ...
Read more >
Repositories | Documentation Center | ABP.IO
Repositories provide the GetQueryableAsync() method that returns an IQueryable<TEntity> object. You can use this object to perform LINQ queries on the entities ...
Read more >
Configure syncing from more than one source of truth
Config Sync supports Git repositories, Helm charts, and OCI images as the source of truth. Namespace-scoped sources of truth must use the unstructured...
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