Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Updating a value in a all the Tenant Database #4132


User avatar
0
pankajmathur created

Hi All,

We have a situation where we have added a field in the existing table and we want to insert a record in that table in all the tenants. This new record is to be inserted in all the existing 500 tenants. What is the preferred way of doing so. Please help with the code snipete if possible.

Thanks in Advance


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @pankajmathur,

    It is better to do it in your Entity Framework Seed method. When you apply the migration for new column to tenant databases, your new record will be inserted as well.

    Migrator tool can apply new migration to all tenant databases.

    Thanks.

  • User Avatar
    0
    pankajmathur created

    Seed method is working well for the host but not for the tenants in .net core. Can you please suggest some alternatives.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @pankajmathur,

    You can modify SeedHelper to get all active tenant's and then, you can run your migration code by switcing to each tenant context one by one (starting a UoW and SetTenantId).

    This topic can help you #3591@0eba207a-3d96-480b-ba3d-91d842f99eb0.