Hi Joe,

In my view, a DSN is a variable that properly belongs to an application. Therefore, I'd go with putting it in onApplicationStart, since by the very nature of its name, implies that you are setting variables belonging to the application.

Others may view it differently, however.

Sam


Joe Lakey wrote, On 6/7/2007 11:03 AM:
Another newbie question to provide a little light diversion from
interfaces and method overloading...

My application uses only one DSN, and I'd like to set it in one place.
I'm cfincluding two files in onRequest(): server_config.cfm, which sets
server/environment variables, and app_config.cfm, which sets
application-specific variables; both set variables in Request scope. It
would seem that one of these includes would be the place to set the DSN,
i.e., <cfset Request.DSN = "myDSN">. However, in onApplicationStart()
and onSessionStart() I'm instantiating components that take the DSN as
an argument to their init() methods. If I understand the sequence that
Application.cfc methods are executed, onApplicationStart() and
onSessionStart() won't have access to variables set in onRequest(). So
if I want to set the DSN in only one place, where is the best place to
do it?

It's probably obvious (and there's probably a better way to architect
the whole app to avoid this, but...), but I'm still getting my mind
around this OO stuff.

Thanks,
Joe


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






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

Reply via email to