Open Closed

Where and How to move shared Entities to global or shared database in a Multi-Tenant SaaS application? #1995


User avatar
0
Yaduraj created

We are working on an Application where each Tenant will share some common data say: Bank Information. Previously, We kept that bank information (All the bank related tables ) in Tenant Scope. Now we want to move the Bank information to a global database where each tenant can access it. Our current approach is 'Database per tenant'

**For Example: ** I have Tennat_1 and it is mapped with Some banks (say ABC, XYZ) Now If we create Tenant_2, we should be able to map these Banks to this new Tenant and other Tenant(s). So on Login, each Tenant will acess their own mapped Bank.

We also wanna manage this Bank data at global level where Tenant is managed.

  1. How can we add these Bank Entities to a global database or shared database.

  2. If added, then how Tenant will access it? Do we need to extend the code in order to acess Global Bank Enitites? ( We seemlessly wants to access these Bank entites, like CurrentUser and CurrentTenant)

  3. How can we implement Domain service for Bank Information like IdentityManager

  4. Please suggest suitable Database Architecture and approach.

Kindly provide the solution as soon as possible.** Also, Let us know if we can get support via calls or online meetings.**

Thanks!

  • ABP Framework version: v4.3.1
  • UI type: Angular / MVC
  • DB provider: EF Core / PostgreSQL

2 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director
    1. How can we add these Bank Entities to a global database or shared database.
      • if you don't inherit from IMultiTenant interface then the entity will be a shared entity across the tenants.
    2. If added, then how Tenant will access it? Do we need to extend the code in order to acess Global Bank Enitites? ( We seemlessly wants to access these Bank entites, like CurrentUser and CurrentTenant)
      • If you want to join Bank entity with Tenant entity then create a new table TenantBank entity. TenantBank entity properties are: TenantId <guid>, BankId <guid>
        Populating a bank dropdown query will Select bank.name, bank.id from TenantBanks where TenantId = xxxxxxx
    3. How can we implement Domain service for Bank Information like IdentityManager
      • Create IBankDomainService : IDomainService and BankDomainService : DomainService, IBankDomainService in the *.Domain project.
    4. Please suggest suitable Database Architecture and approach.
      • the answers explain the database architecture.

    Let us know if we can get support via calls or online meetings

    • Sorry but there's no live support.
  • User Avatar
    0
    Yaduraj created

    Hi @albert,

    Thanks for the response.

    How can we add these Bank Entities to a global database or shared database.

    • if you don't inherit from IMultiTenant interface then the entity will be a shared entity across the tenants.

    By this you mean if Banks are defined for one Tenant then other Tenants will get access to Banks too? Don't we need to add these Bank Entites to Host database? Or Can we keep them in Tenant database?

Made with ❤️ on ABP v9.1.0-preview. Updated on December 26, 2024, 06:07