On 6/8/07, Joe Lakey <[EMAIL PROTECTED]> wrote:
The post about user-dependent DSNs was from someone responding to my original question. My app uses only one DSN.
Sorry about that, got lost in the shuffle! :-) To use a Config CFC, would I hard-code the settings variables in the
Config CFC file, instantiate it in application scope in onApplicationStart(), then call application.config.getDSN() (for example)? What would be the benefit of this approach over including a settings file in onApplicationStart() and/or onRequest()?
No, I wouldn't even instantiate the Config CFC into the application scope. I would instantiate and pass it into the other CFCs that need it, and those CFCs would themselves be stored in the application scope. Thus, becuase (what I am going to call) your Service CFCs are stored in the application scope, and because they are holding a reference to the Config CFC as an internal instance variable, you don't actually need to put the Config CFC into the application scope yourself. Hopefully that makes sense. I definitely wouldn't want to call application.config.getDSN(). Nothing should know that it is in the application scope. In fact, as a rule your CFCs should be totally ignorant of anything outside of themselves (a session facade CFC is a notable exception but that's another topic). You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org