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

Tenants sharing data #2252


User avatar
0
paradoxit created

Can anyone please advise a way to share data across tenants (ideally grouped). I would like for exampleTenant A and Bto share some data (still have the ability to store their own) and then Tenant D and E might want to share data also.

Any advice on this would be greatly appreciated.

Davd Hawkins


4 Answer(s)
  • User Avatar
    0
    maharatha created

    We did something similar. Put the tenants you want to share data into one organization and then switch off the data filter for Tenant and switch on the Organization filter.

  • User Avatar
    0
    paradoxit created

    Thanks, how do I put tenants into an organisation? there is no column in the database to do this. Do I just extend Tenant with IMustHaveOU interface?

    Also how do you switch off the data filter for Tenant and switch on the Organization filter.

    Are there any guides or examples on how to achieve this?

    Thanks, David Hawkins

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can extend Tenant entity and add OrganizationUnitId to it. You can read this doc for that <a class="postlink" href="https://aspnetzero.com/Documents/Extending-Existing-Entities">https://aspnetzero.com/Documents/Extend ... g-Entities</a>.

    But this approach has some problems.

    Disabling tenancy filter in DB Per Tenant architecture will not work. Consider that, you are storaing Tenant A's data in DB1 and TenantB's data in DB2.

    In that case, where do you plan to store shared data between TenantA and TenantB. And let's say that TenantA and TenantB shares some common company information data. When you are listing Companies for TenantA, will you show (shared Companies) + (companies only for TenantA) ?

    If you are not planning to use DB Per Tenant architecture, you can go with organization unit solution. If you are going to use DB Per Tenant architecture, then you can use domain events and sync shared data to each Tenant's database when a shared entity (for example company) is created, edited or deleted. See <a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/EventBus-Domain-Events">http://aspnetboilerplate.com/Pages/Docu ... ain-Events</a>

  • User Avatar
    0
    paradoxit created

    Thanks for the information, I plan to use 1 DB but domain events seems useful too.