Problem using AutoRepositoryTypes
See original GitHub issueHi @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:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
nevermind, figured out the issue constructor was protected
@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.