Ends in:
3 DAYS
5 HRS
50 MIN
38 SEC
Ends in:
3 D
5 H
50 M
38 S
Open Closed

data seeder is not working as expected #2731


User avatar
0
shobhit created
  1. ABP Framework version: v5.1.4
  2. UI type: Angular
  3. DB provider: EF Core
  4. Tiered (MVC) or Identity Server Separated (Angular): yes
  5. Exception message and stack trace:
  6. Steps to reproduce the issue:"
  7. Configure multi-tenant sepearte db:
    1. Host DB
    2. Tenant DB
  8. Create new business entity
  9. follow all process with data seeder as per https://docs.abp.io/en/commercial/latest/tutorials/book-store/part-1?UI=NG&DB=EF
  10. run db migrator
  11. tables get created in
    1. host db
    2. tenant db
  12. data seeder populate only host db table but not the tenant db table

Please let me know how to get this fixed


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

    hi

    Can you provide a simple project? liming.ma@volosoft.com

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I added a tenant and the database is created, the data are seeder in the database.

  • User Avatar
    0
    shobhit created

    Hello @maliming, Yes you are correct, tables are getting created in seperate databases for host and tenant. no issue. My concern is data seeder is filling data in host db only. it should have data in tenant db table also; i am not sure about user tables but my custom tables are not working as per shared code.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    There is no tenant exists. so no data are added in tenant db.

  • User Avatar
    0
    shobhit created

    Hello @maliming, i am not sure how you have mention that there is no tenant exist. i have created 1 tenant and seperate DB for tenant. Please refer the attached screen shot. I have not shared the tenant and host db credentials in code due to security.

    as per attached screen shot:

    • dev_aztute is host db
    • dev_identity is tenant db

    Tenant db has only following tables (higlited one is custom table. this is the same table which is not getting populated with data):

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I change your code to add a tenant then the seeder is working.

    https://support.abp.io/QA/Questions/2731#answer-803b7a5c-d367-44c0-8537-3a02acf0f7a7

  • User Avatar
    0
    shobhit created

    Hello @maliming, Can you please confirm where exactly you have made changes i.e. class and method. will follow in future.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I added a tenant with a custom connections string.

  • User Avatar
    0
    shobhit created

    Similarly tenant conneciton string is available in host db --> SaasTenantConnectionStrings table. My assumption is ABP framework should take care of connection string from this table instead of hardcoding in the applicaiotn. we will have multiple tenant so we cannot keep adding connection string in code.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Yes,

    Can you set a breakpoint for the check if there are any tenants? and its connection strings.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 02, 2024, 12:35