Open Closed

Using second database for AbpAuditLogging module #1657


User avatar
0
fishlong created

Hi guys,

I followed the instructions and put the auditlogging module in the second database, but got "More than one DbContext was found. Specify which one to use. Use the '-Context' parameter for PowerShell commands and the '--context' parameter for dotnet commands." in package console when Add-Migration "Initial".

The same error occurred when I put a custom business module in a separate DB .

Can someone tell me the correct operation?

Check the docs before asking a question: https://docs.abp.io/en/abp/latest/Entity-Framework-Core-Migrations Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v4.3.3
  • UI type:MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

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

    hi

    You can specific the --context parameter.

    dotnet ef migrations add Your_Migration_Name --context MyProjectNameDbContext
    
    dotnet ef migrations add Your_Migration_Name --context MyProjectNameTenantDbContext --output-dir TenantMigrations
    
  • User Avatar
    0
    fishlong created

    thanks a lot!

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 20, 2025, 18:00