0
sghorakavi@cpat.com created
- Create Module with Get and Post APIs. These APIs need to update DB table using IRepository
- Include above Module in the main project
- When IRepository is injected, Cannot access Module APpService from the API
- Without IRepository can access AppService from API
- What is missing ?
Getting error in the api:
Autofac.Core.DependencyResolutionException: An exception was thrown while activating LMSCommunicationController -> Cpat.Bridge.Module.LMSCommunicationAppService.
---> Autofac.Core.DependencyResolutionException: None of the constructors found on type 'Cpat.Bridge.Module.LMSCommunicationAppService' can be invoked with the available services and parameters:
Cannot resolve parameter 'Volo.Abp.Domain.Repositories.IRepository
2[Cpat.Bridge.Module.Data.LmsUserXref,System.Guid] lmsUserXrefRepository' of constructor 'Void .ctor(Volo.Abp.Domain.Repositories.IRepository
2[Cpat.Bridge.Module.Data.LmsUserXref,System.Guid], Volo.Abp.Domain.Repositories.IRepository`2[Cpat.Bridge.Module.Data.LmsTenantXref,System.Guid], Volo.Saas.Host.ITenantAppService, Volo.Abp.Identity.IIdentityUserAppService, Volo.Abp.MultiTenancy.ICurrentTenant)'.
7 Answer(s)
-
0
hi
Can you share the
XXXEntityFrameworkCoreModule
code of your module?Thanks.
-
0
using Microsoft.Extensions.DependencyInjection; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Modularity; using Volo.Saas.EntityFrameworkCore; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.OpenIddict.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.SqlServer; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.TextTemplateManagement.EntityFrameworkCore; using Volo.Abp.LanguageManagement.EntityFrameworkCore; using Volo.Abp.Gdpr; using Volo.Abp.BlobStoring.Database.EntityFrameworkCore; namespace Cpat.Bridge.Module.EntityFrameworkCore; [DependsOn( typeof(ModuleDomainModule), typeof(AbpEntityFrameworkCoreModule) )] [DependsOn(typeof(SaasEntityFrameworkCoreModule))] [DependsOn(typeof(AbpAuditLoggingEntityFrameworkCoreModule))] [DependsOn(typeof(AbpOpenIddictProEntityFrameworkCoreModule))] [DependsOn(typeof(AbpEntityFrameworkCoreSqlServerModule))] [DependsOn(typeof(AbpBackgroundJobsEntityFrameworkCoreModule))] [DependsOn(typeof(AbpSettingManagementEntityFrameworkCoreModule))] [DependsOn(typeof(AbpIdentityProEntityFrameworkCoreModule))] [DependsOn(typeof(AbpPermissionManagementEntityFrameworkCoreModule))] [DependsOn(typeof(TextTemplateManagementEntityFrameworkCoreModule))] [DependsOn(typeof(LanguageManagementEntityFrameworkCoreModule))] [DependsOn(typeof(AbpGdprEntityFrameworkCoreModule))] [DependsOn(typeof(BlobStoringDatabaseEntityFrameworkCoreModule))] public class ModuleEntityFrameworkCoreModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddAbpDbContext<ModuleDbContext>(options => { options.AddDefaultRepositories(includeAllEntities: true); /* Add custom repositories here. Example: * options.AddRepository<Question, EfCoreQuestionRepository>(); */ }); context.Services.AddAbpDbContext<TMS_MVCDbContext>(options => { options.AddDefaultRepositories(includeAllEntities: true); /* Add custom repositories here. Example: * options.AddRepository<Question, EfCoreQuestionRepository>(); */ }); } }
TMS_MVCDbContext is our DBContext.
-
0
hi
Thanks,
ModuleEntityFrameworkCoreModule
seems no problem.Can you share a project to reproduce?
liming.ma@volosoft.com
-
0
Sending you the module code``
-
0
hi
I didn't receive any email. Can you confirm?
You can also share file by https://wetransfer.com/
Thanks.
-
0
Thank you @maliming we resolved it. Now we have different issue.
-
0
Great