Open Closed

How can the Global Admin Role create records in the context of an individual Tenant #3181


User avatar
0
barrett2474 created
  • ABP Framework version: v5.22
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

The global admin of our site needs to add new records in a table for all our Tenants.. Its kind of a bulk process we have.

Can the global Admin make inserts/updates "in the context" of a Tenant?

Thank you!

John


2 Answer(s)
  • User Avatar
    1
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    See: https://docs.abp.io/en/abp/latest/Multi-Tenancy#change-the-current-tenant

    You can change the current tenant.

    For example:

    var tenants = await TenantRepository.GetListAsync();
    
    foreach(var tenant in tenants)
    {
        using(CurrentTenant.Change(tenant.Id))
        {
            //inserts/updates for a tenant here..
        }
    }
    
  • User Avatar
    0
    barrett2474 created

    that's great - thanks for the fast response!

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-rc.1. Updated on June 18, 2025, 09:24