Open Closed

Connect to cuurent Database #6928


User avatar
0
mina created
  • ABP Framework version: V8.1.0
  • UI Type: Blazor WASM
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Dear All,

We need to use use a current Exsiting Database? how could we do so ? and how to add its DB context?

Thanks, Thanks.


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

    hi

    You can check https://support.abp.io/QA/Questions/2846/Existing-Database

    Thanks.

  • User Avatar
    0
    mina created

    this is not exactly what we are looking for

    the existing database will still be used by other systems so we don't need to change it, we just need to have a DB context and models for it in APB Commercial app so that we can read, insert, update, delete from within ABP

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    the existing database will still be used by other systems so we don't need to change it,

    You don't need to change the database and tables.

    You need to :

    1. create the entity/aggregate root classes
    2. add your entity classes to DbContext class. DbSet
    3. configure your entity classes in OnModelCreating method of DbContext
    4. Inject the repository and test it.
  • User Avatar
    0
    mina created

    We need to know how to add another DBcontext to the solution.

    also, can we use the ABPSUITE to create the models?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    We need to know how to add another DBcontext to the solution.

    You can check this : https://docs.abp.io/en/abp/latest/Entity-Framework-Core-Migrations#create-a-second-dbcontext

    also, can we use the ABPSUITE to create the models?

    https://docs.abp.io/en/commercial/latest/abp-suite/generating-entities-from-an-existing-database-table

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