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:"

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

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();
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
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 v10.8.0-preview. Updated on September 21, 2026, 06:18
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.