Open Closed

EntityFrameworkCore and MongoDB module in one common application. #2438


User avatar
0
imranStem created

Hello Team,

I have one ABP application with the EntityFrameworkCore integration. I have created one module with MongoDB and integrated it with the existing application. I injected the ApplicationService, HttpApi, and MongoDB modules into the host application of the main application. With this configuration, when I run the application, I am getting the below exception in the application.

  • ABP Framework version: v4.3.2
  • UI type: Angular
  • DB provider: EF Core in application / MongoDB as Module
  • Tiered (MVC) or Identity Server Separated (Angular): yes, its separated
  • Exception message and stack trace:
  An error occurred during ConfigureServices phase of the module Test.MongoDB.TestMongoDbModule, Test.MongoDB,
Volo.Abp.AbpInitializationException: An error occurred during ConfigureServices phase of the module Test.MongoDB.TestMongoDbModule, Test.MongoDB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details.
---> System.MissingMethodException: Method not found: 'System.Collections.Generic.List`1<System.Type> Volo.Abp.DependencyInjection.AbpCommonDbContextRegistrationOptions.get_ReplacedDbContextTypes()'.
at Microsoft.Extensions.DependencyInjection.AbpMongoDbServiceCollectionExtensions.AddMongoDbContext[TMongoDbContext](IServiceCollection services, Action`1 optionsBuilder)
at Test.MongoDB.TestMongoDbModule.ConfigureServices(ServiceConfigurationContext context) in ..\MongoDbModule\src\Test.MongoDB\MongoDb\TestMongoDbModule.cs:line 32
at Volo.Abp.AbpApplicationBase.ConfigureServices()
--- End of inner exception stack trace ---
at Volo.Abp.AbpApplicationBase.ConfigureServices()
at Volo.Abp.AbpApplicationBase..ctor(Type startupModuleType, IServiceCollection services, Action`1 optionsAction)
at Volo.Abp.AbpApplicationWithExternalServiceProvider..ctor(Type startupModuleType, IServiceCollection services, Action`1 optionsAction)
at Volo.Abp.AbpApplicationFactory.Create(Type startupModuleType, IServiceCollection services, Action`1 optionsAction)
at Volo.Abp.AbpApplicationFactory.Create[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplication[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Test.Startup.ConfigureServices(IServiceCollection services) in ..\aspnet-core\src\Test.HttpApi.Host\Startup.cs:line 12
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Test.Program.Main(String[] args)
  • Steps to reproduce the issue:" Add MongoDB module into the EFCore application.

1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Only one of EF Core or MongoDB can be used in a monolithic application, you can use EF Core or MongoDB in different microservices.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11