Hi,I'd like to share this!
1- I think it is better & easier for multi-tenant support to start in NC code & not plugin.
2- As SAAS provider , I agree to use separate db approch to avoid long run upgrades & conflicts when having too many customers concerning security & db overload.
3- For querying multi-tenant databases, I found this library http://enzosqlshard.codeplex.com/
from the links I previously mentioned,I haven't try it yet!
4-We'll consider default NC installationto be store owner or SAAS provider.
5-Now,our registered customers will be our tenants! (i.e B2B).
6-We'll add a Tenant Table in default NC db including fields (Id,CustomerId,DB_Path,....).
7-CustomerId in Tenant Table is FK to Customers table.
8-We'll use DB_Path with enzosqlshard for querying tenant db. Again,I haven't try it yet!
7-We'll create new table Tenant_Entity_Mapping (Id,TenantID,EntityID) just like StoreMapping design to serve as config foreach tenant to indicate which payment method,shipping method,.. that our Tenant subscribe to let our
ONE DEFAULT COPY OF NC use it in routing.
8-For routing,we have front & back ends!
I think it is better to create ITenantContext something like IStoreContext & use it in classes BaseNopController in both
NopWeb & Admin for the sake of routing,we also may include new customer role Tenant to be used much like Vendor
rule in front end & Admin role in back end.
I hope it may helps!