35
Views
2
Comments
Multi Tenant
Question

Is possible make a Multi Tenant App using external entities?

mvp_badge
MVP
Rank: #69

Hello José.

MultiTenancy is a concept that is implemented in OutSystems. You can ignore it, use it, expand it, or reimplement it.

External Entities are almost identical to native Entities. Unfortunately, you can't just configure them with Is Multitenant=Yes, but you can have a different DB for each tenant so data is isolated by tenant.

What exactly is your scenario?



Useful documentation:

https://success.outsystems.com/Support/Enterprise_Customers/Maintenance_and_Operations/How_to_Build_a_Multi-tenant_Application

https://success.outsystems.com/Support/Enterprise_Customers/Maintenance_and_Operations/Designing_the_architecture_of_your_OutSystems_applications/Designing_Scalable_Multi-Tenant_Applications


Rank: #177

Hi José,


If I understand right, you want to apply the MultiTenant concept from OutSystems in an external database.

I think it is possible, but you would have to manage it manually. 

All the advantages from outsystems would not be automatically applied.


As a solution you could add a TenantId in your external database and filter it by the tenantId that stays in the siteProperties in runtime.


Another idea, that may be a little bit costly but may help you to use the advantages of outsystems, is to create an extension table in outsystems for each of your external table, mapping the id as a primary key for example.

This way you would make an Inner Join, and only bring the data from the tenant you are using since OutSystems would filter the tenant for you.


This last solution is not indicated by best practices since it would made a Join between an external and an internal table. However is a solution.  


Also important to know that if you expose the TenantId in the advanced options from the entities, all the queries must be manually filtered for the tenant. If you dont expose it, OutSystems will filter automatically by the tenant of the logged user.