Open Closed

Architecture Advice — SaaS Application + Shared Marketplace #483


User avatar
0
theChrisMarsh created

We are looking for architecture advice given the ABP Host / tenant model.

Example Business Model Scenario

A car dealership SaaS Application that helps them run their business (payroll, inventory of "Vehicles", sales, taxes, contracts, repair shop, etc). This would be implemented in the multi-tenancy model, with different editions, each tenant getting their own database, etc.

In addition, a Shared Marketplace where all the inventory of "Vehicles" from each tenant is merged together and presented together to the public.

Architecture Questions

How would you recommend we implement Entities (or Aggregate Roots) for Vehicles?

Would Vehicles be Non-Multi-Tenant (part of the host)? If so:

  • How would we link those back to tenants?
  • How would we secure them so they could only be modified by the owning tenant?

Should "Vehicles" implement the IMultiTenant interface? If so:

  • How would we search across all tenant's inventory of "Vehicles" at the same time in a performant way?

1 Answer(s)
  • User Avatar
    1
    alper created
    Support Team Director

    for the shared entities like Vehicles; don't add IMultiTenant interface. if you are joining a MultiTenant entity with Non-MultiTenant entity you can disable MultiTenancy for that particular query.

    
     public async Task<long> GetOnSaleVehiclesCountAsync()
            {
                using (_dataFilter.Disable<IMultiTenant>())
                {
                     //    some query with multitenant entities included.
                }
            }
    
    

    https://docs.abp.io/en/abp/latest/Multi-Tenancy#data-filtering-disable-the-multi-tenancy-filter

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35