Open Closed

Multiple database migrations failed. #9873


User avatar
0
1198462239 created

4 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • The error message in your screenshot indicates two main issues when running dotnet ef migrations add for multiple DbContexts:
    1. Entity Framework Tools Version Mismatch
      • The EF Core tools version (8.0.8) is older than the runtime version (9.0.8).
      • Solution: Update your EF Core tools to match the runtime version. Run:
    dotnet tool update --global dotnet-ef
    
     Or, if you use a local tool manifest:
    
    dotnet tool update dotnet-ef
    
    1. Unable to Create a DbContext Instance
      • The error says it cannot create a DbContext of type WaveSecureVeltris.EntityFrameworkCore.ConfigDbContext.
      • This is usually caused by a missing or misconfigured IDesignTimeDbContextFactory<ConfigDbContext>.
      • Solution: Ensure you have a correctly implemented ConfigDbContextFactory in your EntityFrameworkCore project. The factory should look like:
    public class ConfigDbContextFactory : IDesignTimeDbContextFactory<ConfigDbContext>
         {
             public ConfigDbContext CreateDbContext(string[] args)
             {
                 var optionsBuilder = new DbContextOptionsBuilder<ConfigDbContext>();
                 optionsBuilder.UseSqlServer("Your_Connection_String_Here");
                 return new ConfigDbContext(optionsBuilder.Options);
             }
         }
    
    • Make sure the connection string is valid and the factory is in the same assembly as your DbContext.

    Summary of Steps:

    1. Update EF Core tools to match your runtime.
    2. Double-check your IDesignTimeDbContextFactory implementation and connection string.

    References:


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share the DBContext factory code

  • User Avatar
    0
    1198462239 created

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share a project to reproduce?

    liming.ma@volosoft.com

    Thanks

Learn More, Pay Less
33% OFF
All Trainings!
Get Your Deal
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 10, 2025, 06:30