I suppose the question here is, why not consolodate them all in exactly one
place: a Config CFC?

From what you said you wouldn't want to set the DSN to application.dsn in
onApplicationStart() becuase then its not variable. I thought you said the
DSN depends on the type of user. So if you're going to keep down this road,
wouldn't you set it to session.dsn in onSessionStart()?



On 6/7/07, Joe Lakey <[EMAIL PROTECTED]> wrote:

This is what I've done in the past, but I'm trying to consolidate these
configuration-type settings into as few places as possible. Setting them
in request scope seems to be the recommended approach. I guess the
compromise would be setting Application.DSN in onApplicationStart() and
setting request.DSN=Application.DSN in my config file that I include in
onRequest()?

Joe

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Sammy Larbi
> Sent: Thursday, June 07, 2007 11:43 AM
> To: [email protected]
> Subject: Re: [CFCDEV] Application.cfc: where to set DSN
>
> 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/[email protected]
> >
> >
> >
> >
>
>
>
> 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/[email protected]
>
>


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/[email protected]




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/[email protected]

Reply via email to