--------- Original Message ---------
--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/55137a72-d587-4865-a6bb-e1ffce17f90c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The Coldbox framework settings reside in the Application scope. They are “globals” and should not be used for request-level data. If you modify those settings during the request, then those modifications can affect other concurrent users. I would NOT change the application name, based on the tenant. It’s just not scalable.
For multi-tenant operations, anything in-request settings related to the tenant should reside in transient objects for be scoped in to the request. You can then leverage query/ORM caching to minimize the database overhead for those settings which are built/scoped on every request. Wirebox allows you to do this in the component attributes:
component name="TenantService" scope="REQUEST"{
...
}
If you really wanted to access those via the Coldbox settings, you would want to enclose any tennant-based config within a closure to ensure that the function which creates those settings is run every time:
tennantSettings = function(){
return application.Wirebox.getInstance("TenantService").getSettings()
}
Then you could inject that setting in to a component (which we scoped to the request previously), with the understanding that you would have to call the setting, itself, as a function:
property name="tenatSettings" inject="coldbox:setting:tenantSettings";
var tenantSettings = VARIABLES.tenantSettings();
As for your Contentbox questions, ContentBox is not yet setup for multi-tenant content, though that’s on the roadmap. Modifications to the core and the ORM models, which would take you off the upgrade path, would be required.
From a data model standpoint, a common method for handling multi-tenancy is composite primary keys. There will be a number of models which are global, but if your data is going to be tenant restricted on every query, then a composite key makes a good deal of sense.
HTH,
Jon
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/3dac555f-fd16-4473-818f-51f2c3351954%40googlegroups.com.