Open Closed

ABP Connect to existing database #3279


User avatar
0
ianbaddock created

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

  • ABP Framework version: v5.3.0
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

I am creating a ABP commercial solution with its own set of data tables which are all generated using ABP suite. I have a use case where I also need to connect to another systems database to read and update its data. This other system is an older style .NET solution with its own data migrations etc. What would be the best way to include data from that system in my ABP solution.

As an example, if I create a record in one of my ABP solution tables, I would like to add a similar row in the other systems database.

Is it possible to implement this functionality by creating another dbcontext attached to the other database and someone disable any migrations and then query the other databases tables like that?


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

    hi You can try to generate a DbContext and use it. https://docs.microsoft.com/en-us/ef/core/cli/dotnet#dotnet-ef-dbcontext-scaffold https://www.learnentityframeworkcore.com/walkthroughs/existing-database

  • User Avatar
    0
    ianbaddock created

    hi You can try to generate a DbContext and use it. https://docs.microsoft.com/en-us/ef/core/cli/dotnet#dotnet-ef-dbcontext-scaffold https://www.learnentityframeworkcore.com/walkthroughs/existing-database

    Just to clarify, this would NOT be an AbpDbContext?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Yes, Because this is not a database created by AbpDbContext.

    You can give it a try. Just use a normal ef core dbcontext.

  • User Avatar
    0
    ianbaddock created

    Yes, Because this is not a database created by AbpDbContext.

    You can give it a try. Just use a normal ef core dbcontext.

    perfect, thanks mate

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09