Open Closed

share an entity that is owned by the host to all tenants #2979


User avatar
0
nielsklijn created

How can we share an entity that is created by the host to all tenants?

  • Not using IMultitenant will make the entity available to all tenants, but it will only be stored in the host database

  • In my specific scenario, I use a database per tenant

  • How can we guarantee referential integrity (foreign key) this way?

  • Is there a way to sync entities across all tenant databases when IMultitenant is not used

  • ABP Framework version: v5.1.2

  • UI type:Blazor

  • DB provider: EF Core /

  • Tiered (MVC) or Identity Server Separated (Angular): no

  • Exception message and stack trace:

  • Steps to reproduce the issue:"


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

    Is there a way to sync entities across all tenant databases when IMultitenant is not used

    You can switch to Host DB when querying this entity.

    using (CurrentTenant.Change(null)) //Host
    {
        return await _yourEntityRepository.GetAllAsync();
    }
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 26, 2024, 06:07