Re: [CFCDEV] Application.cfc: where to set DSN
On Friday 08 Jun 2007, Brian Kotek wrote: remote facade generation I keep seeing references to this, and 'security advisors'. Is there a good blog post or web page somewhere ? -- Tom Chiverton Helping to advantageously promote ubiquitous action-items on: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. 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
Re: [CFCDEV] Application.cfc: where to set DSN
Tom Chiverton wrote, On 6/8/2007 8:50 AM: On Friday 08 Jun 2007, Joe Lakey wrote: 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)? Yeah. What would be the benefit of this approach over including a settings file in onApplicationStart() and/or onRequest()? Including a file has overhead (reading the file from disk), where as accessing an application var. is just reading memory. You might want to benchmark it though, to see if it really makes much of a difference (after all, if it's included often, it'll be in the disk cache). Or compiled with the other template, or of course you can check to see if the parameters have been defined, and only include it if not. I wouldn't suspect this to be an issue at all, but I've been known to be wrong on occasion. =) Sam 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
Re: [CFCDEV] Application.cfc: where to set DSN
Brian Kotek wrote, On 6/8/2007 2:18 PM: Philip, questions are good. However, these questions don't really have any bearing on why you would use ColdSpring. It makes no difference what my database tables look like, what methods the CFCs have, what the datasource looks like, what mapping you use for your component paths, or what the index.cfm or maintenance screens look like. But, it would be good to know/understand why you have so many classes (for what seems like it should just be a simple Product class), what they are doing, and why you have designed them that way. It would be off topic to the expressed subject, but it would be good. =) Sam What ColdSpring does is create CFCs for you and manage their relationships so you don't have to (it also does a lot more such as AOP and remote facade generation but those are separate topics). It's completely generic. It will work with any CFCs, whether you are using a database or not, and regardless of what the CFCs actually do or how you display the data they provide. However, if code would help, have a look at the code from my presentation at the Frameworks conference earlier this year: http://www.briankotek.com/blog/files/framework_agnostic_models_presentation_code.zip Hope that helps, Brian On 6/8/07, *Phillip Senn* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Thanks Brian for your posts. In your blog, you use this as an example: beans bean id=productService class=components.ProductService constructor-arg name=productFactory ref bean=productFactory / /constructor-arg constructor-arg name=productDAO ref bean=productDAO / /constructor-arg constructor-arg name=productGateway ref bean=productGateway / /constructor-arg /bean bean id=productDAO class=components.ProductDAO constructor-arg name=config ref bean=config / /constructor-arg /bean bean id=productGateway class=components.ProductGateway constructor-arg name=config ref bean=config / /constructor-arg /bean bean id=config class=components.config constructor-arg name=configFile value/config/configFile.xml/value /constructor-arg /bean bean id=productFactory class=components.ProductFactory / /beans 1. What does the Product table look like? 2. What does ProductService.cfc look like? 3. What does ProductFactory.cfc look like? 4. What does ProductDAO.cfc look like? 5. What does ProductGateway.cfc look like? 6. What does Config.cfc look like? 7. What does Application.cfc look like? 8. What does your ColdFusion datasource look like in the cfide administrator? 9. What does your mapping look like if you refer to myapp.components.? 10. What does your Index.cfm page look like? 11. What does your maintenance screen look like? 12. What does your Report screen look like? 13. What does your Inquiry screen look like? When I use the phrase look like, what I'm trying to convey to you is: What is the exact source code for this /thing/ which I'm describing, whether it be a sql script, a ColdFusion component, a cfm page that outputs plain old HTML with javascript and cascading style sheets, or a cfm page that outputs a flex application. I'm trying to show you that I'm not trying to be obnoxious, but rather that I have lots of questions. 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
RE: [CFCDEV] Application.cfc: where to set DSN
The post about user-dependent DSNs was from someone responding to my original question. My app uses only one DSN. 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()? Thanks, Joe -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Kotek Sent: Thursday, June 07, 2007 1:44 PM To: cfcdev@cfczone.org Subject: Re: [CFCDEV] Application.cfc: where to set DSN 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: cfcdev@cfczone.org mailto:cfcdev@cfczone.org 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 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 http://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 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 http://www.katapultmedia.com An archive of the CFCDev list is available
Re: [CFCDEV] Application.cfc: where to set DSN
On Friday 08 Jun 2007, Joe Lakey wrote: 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)? Yeah. What would be the benefit of this approach over including a settings file in onApplicationStart() and/or onRequest()? Including a file has overhead (reading the file from disk), where as accessing an application var. is just reading memory. You might want to benchmark it though, to see if it really makes much of a difference (after all, if it's included often, it'll be in the disk cache). -- Tom Chiverton Helping to widespreadedly incentivize world-class content on: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. 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
RE: [CFCDEV] Application.cfc: where to set DSN
The post about user-dependent DSNs was from someone responding to my original question. Yeah, that was me :) call application.config.getDSN() Yes, let's see some code! What would be the benefit of this approach Hello! Brian and Peter are saying I'm just so spoiled by ColdSpring that I would never build an app without it. Let's cut to the chase and see an example using ColdSpring. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joe Lakey Sent: Friday, June 08, 2007 9:39 AM To: cfcdev@cfczone.org Subject: RE: [CFCDEV] Application.cfc: where to set DSN The post about user-dependent DSNs was from someone responding to my original question. My app uses only one DSN. 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()? Thanks, Joe -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Kotek Sent: Thursday, June 07, 2007 1:44 PM To: cfcdev@cfczone.org Subject: Re: [CFCDEV] Application.cfc: where to set DSN 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: cfcdev@cfczone.org mailto:cfcdev@cfczone.org 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 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 http://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
Re: [CFCDEV] Application.cfc: where to set DSN
Actually, Brian is spoiled by ColdSpring. I'm spoiled by LightWire. Horses for courses . . . On 6/8/07 9:53 AM, Phillip Senn [EMAIL PROTECTED] wrote: What would be the benefit of this approach Hello! Brian and Peter are saying I'm just so spoiled by ColdSpring that I would never build an app without it. Let's cut to the chase and see an example using ColdSpring. 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
Re: [CFCDEV] Application.cfc: where to set DSN
On 6/8/07, Phillip Senn [EMAIL PROTECTED] wrote: Let's cut to the chase and see an example using ColdSpring. Not much to show really. ColdSpring is actually shockingly easy to use. This will create your UserService instance. Because you tell ColdSpring that this CFC requires a Config instance as a constructor argument, ColdSpring automatically handles creating the Config CFC and passing it to the UserService constructor as an argument. ?xml version=1.0 encoding=UTF-8? beans bean id=userService class=myapp.components.UserService constructor-arg name=config ref bean=config / /constructor-arg /bean bean id=config class=myapp.components.Config / /beans I have several blog posts about it as well if you care to have a look: http://www.briankotek.com/blog/index.cfm?mode=catcatid=963BA7A1-3048-23C1-DDD298C03361DDC9 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
Re: [CFCDEV] Application.cfc: where to set DSN
On 6/8/07, Phillip Senn [EMAIL PROTECTED] wrote: Let's cut to the chase and see an example using ColdSpring. Actually I think this blog entry specifically would interest you since it describes almost the exact situation we've been talking about in this thread: http://www.briankotek.com/blog/index.cfm/2006/5/31/Why-Use-ColdSpring 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
Re: [CFCDEV] Application.cfc: where to set DSN
On Friday 08 Jun 2007, Phillip Senn wrote: Let's cut to the chase and see an example using ColdSpring. Does no-one read the Blogregator these days :-) http://weblogs.macromedia.com/mxna/controller.cfm?handler=PostHandleraction=clickpostId=190692nextPage=http%3A%2F%2Fwww%2Erachaelandtom%2Einfo%2Fnode%2F1453 -- Tom Chiverton Helping to dynamically scale innovative e-services on: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. 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
Re: [CFCDEV] Application.cfc: where to set DSN
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
Re: [CFCDEV] Application.cfc: where to set DSN
Very true Peter! I honstely haven't looked at LightWire at all since ColdSpring does everything I need it to. But I should try to set aside some time to kick the tires just to see how you approached the problem. On 6/8/07, Peter Bell [EMAIL PROTECTED] wrote: Actually, Brian is spoiled by ColdSpring. I'm spoiled by LightWire. Horses for courses . . . 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
RE: [CFCDEV] Application.cfc: where to set DSN
Thanks Brian for your posts. In your blog, you use this as an example: beans bean id=productService class=components.ProductService constructor-arg name=productFactory ref bean=productFactory / /constructor-arg constructor-arg name=productDAO ref bean=productDAO / /constructor-arg constructor-arg name=productGateway ref bean=productGateway / /constructor-arg /bean bean id=productDAO class=components.ProductDAO constructor-arg name=config ref bean=config / /constructor-arg /bean bean id=productGateway class=components.ProductGateway constructor-arg name=config ref bean=config / /constructor-arg /bean bean id=config class=components.config constructor-arg name=configFile value/config/configFile.xml/value /constructor-arg /bean bean id=productFactory class=components.ProductFactory / /beans 1. What does the Product table look like? 2. What does ProductService.cfc look like? 3. What does ProductFactory.cfc look like? 4. What does ProductDAO.cfc look like? 5. What does ProductGateway.cfc look like? 6. What does Config.cfc look like? 7. What does Application.cfc look like? 8. What does your ColdFusion datasource look like in the cfide administrator? 9. What does your mapping look like if you refer to myapp.components.? 10. What does your Index.cfm page look like? 11. What does your maintenance screen look like? 12. What does your Report screen look like? 13. What does your Inquiry screen look like? When I use the phrase look like, what I'm trying to convey to you is: What is the exact source code for this /thing/ which I'm describing, whether it be a sql script, a ColdFusion component, a cfm page that outputs plain old HTML with javascript and cascading style sheets, or a cfm page that outputs a flex application. I'm trying to show you that I'm not trying to be obnoxious, but rather that I have lots of questions. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Kotek Sent: Friday, June 08, 2007 10:40 AM To: cfcdev@cfczone.org Subject: Re: [CFCDEV] Application.cfc: where to set DSN On 6/8/07, Phillip Senn [EMAIL PROTECTED] wrote: Let's cut to the chase and see an example using ColdSpring. Actually I think this blog entry specifically would interest you since it describes almost the exact situation we've been talking about in this thread: http://www.briankotek.com/blog/index.cfm/2006/5/31/Why-Use-ColdSpring 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
Re: [CFCDEV] Application.cfc: where to set DSN
Philip, questions are good. However, these questions don't really have any bearing on why you would use ColdSpring. It makes no difference what my database tables look like, what methods the CFCs have, what the datasource looks like, what mapping you use for your component paths, or what the index.cfm or maintenance screens look like. What ColdSpring does is create CFCs for you and manage their relationships so you don't have to (it also does a lot more such as AOP and remote facade generation but those are separate topics). It's completely generic. It will work with any CFCs, whether you are using a database or not, and regardless of what the CFCs actually do or how you display the data they provide. However, if code would help, have a look at the code from my presentation at the Frameworks conference earlier this year: http://www.briankotek.com/blog/files/framework_agnostic_models_presentation_code.zip Hope that helps, Brian On 6/8/07, Phillip Senn [EMAIL PROTECTED] wrote: Thanks Brian for your posts. In your blog, you use this as an example: beans bean id=productService class=components.ProductService constructor-arg name=productFactory ref bean=productFactory / /constructor-arg constructor-arg name=productDAO ref bean=productDAO / /constructor-arg constructor-arg name=productGateway ref bean=productGateway / /constructor-arg /bean bean id=productDAO class=components.ProductDAO constructor-arg name=config ref bean=config / /constructor-arg /bean bean id=productGateway class=components.ProductGateway constructor-arg name=config ref bean=config / /constructor-arg /bean bean id=config class=components.config constructor-arg name=configFile value/config/configFile.xml/value /constructor-arg /bean bean id=productFactory class=components.ProductFactory / /beans 1. What does the Product table look like? 2. What does ProductService.cfc look like? 3. What does ProductFactory.cfc look like? 4. What does ProductDAO.cfc look like? 5. What does ProductGateway.cfc look like? 6. What does Config.cfc look like? 7. What does Application.cfc look like? 8. What does your ColdFusion datasource look like in the cfide administrator? 9. What does your mapping look like if you refer to myapp.components .? 10. What does your Index.cfm page look like? 11. What does your maintenance screen look like? 12. What does your Report screen look like? 13. What does your Inquiry screen look like? When I use the phrase look like, what I'm trying to convey to you is: What is the exact source code for this /thing/ which I'm describing, whether it be a sql script, a ColdFusion component, a cfm page that outputs plain old HTML with javascript and cascading style sheets, or a cfm page that outputs a flex application. I'm trying to show you that I'm not trying to be obnoxious, but rather that I have lots of questions. 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
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/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
Re: [CFCDEV] Application.cfc: where to set DSN
Exactly. Set it in onApplicationStart() using an application variable (ie application.dsn) and then pass that into whatever needs it. Of course, if you used ColdSpring, you could let it handle all this. ;-) HTH, Brian On 6/7/07, Sammy Larbi [EMAIL PROTECTED] wrote: 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 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
RE: [CFCDEV] Application.cfc: where to set DSN
I'm on a shared hosting environment (hostmysite.com) which allows only one database, but multiple sql server _users_. So my Datasource name is 1. DSN (ColdFusion) 2. UserName (sql server) 3. Password (sql server) So my DSN changes depending upon how you login. Developers login as one sqlserver user, customers login as the other. The login table always comes from the production username. So I've put my DSN in the session scope, because it could vary depending upon different sessions. In addition, I have other Datasource options that could vary depending upon the session: 1. Logging (keeping track of what commands this session has issued). 2. Error Trapping (on for users, off for developers). I'm working on moving my development to my local machine, but in my early attempts at learning cf, I wanted all development to be done on the server that would ultimately be the production server. That way if I ran into any permission problems, it would come out early. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sammy Larbi Sent: Thursday, June 07, 2007 12:43 PM To: cfcdev@cfczone.org 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/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 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
Re: [CFCDEV] Application.cfc: where to set DSN
Still no problem. Create a Config CFC (or whatever) to encapsulate this info, have ColdSpring create it and inject it into your other CFCs. Your cfquery calls then call config.getDSN() to determine the DSN name at runtime. Within the Config CFC you can store the actual values in the session scope and that is what it will return. Or the Config CFC could in turn hold a reference to a SessionFacade CFC which handles getting and setting data in the session scope if you prefer to keep all access to the session scope encapsulated in one place. This is probably overkill for one value (the DSN) but usually there is a bunch of Config data (production server may have different paths or other settings than, say, localhost) and once you start dealing with multiple settings or multiple variability of the settings, encapsulating this into its own CFC can be very useful. Hope that helps. Brian On 6/7/07, Phillip Senn [EMAIL PROTECTED] wrote: I'm on a shared hosting environment (hostmysite.com) which allows only one database, but multiple sql server _users_. So my Datasource name is 1. DSN (ColdFusion) 2. UserName (sql server) 3. Password (sql server) So my DSN changes depending upon how you login. Developers login as one sqlserver user, customers login as the other. The login table always comes from the production username. So I've put my DSN in the session scope, because it could vary depending upon different sessions. In addition, I have other Datasource options that could vary depending upon the session: 1. Logging (keeping track of what commands this session has issued). 2. Error Trapping (on for users, off for developers). I'm working on moving my development to my local machine, but in my early attempts at learning cf, I wanted all development to be done on the server that would ultimately be the production server. That way if I ran into any permission problems, it would come out early. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sammy Larbi Sent: Thursday, June 07, 2007 12:43 PM To: cfcdev@cfczone.org 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/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 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
RE: [CFCDEV] Application.cfc: where to set DSN
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: cfcdev@cfczone.org 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/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 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
Re: [CFCDEV] Application.cfc: where to set DSN
Brian Kotek said the following on 6/7/2007 1:17 PM: I'm just so spoiled by ColdSpring that I would never build an app without it. ;-) Hey, that's my line ;-) .Peter 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
Re: [CFCDEV] Application.cfc: where to set DSN
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: cfcdev@cfczone.org 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/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 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
Re: [CFCDEV] Application.cfc: where to set DSN
+1. Only thing I put into application.cfc (in terms of a config property) is application.name which I need to include the framework that calls the application specific config bean that contains all of the other app specific config info. Encapsulating it in a config bean gives you a bunch more flexibility to change how it is created or stored without breaking the API you expose to the rest of your app. Best Wishes, Peter On 6/7/07 2:43 PM, Brian Kotek [EMAIL PROTECTED] wrote: 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: cfcdev@cfczone.org 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 http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://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 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 http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://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 http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://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 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
RE: [CFCDEV] Application.cfc: where to set DSN
Peter, [Off Topic] Thanks for the ColdFusion Meetup session today. That was all great info. I'm still trying to absorb all this OO stuff. Your writings (and now frequent presos) are a great help. I look forward to playing with your code generator tools in the future. You are a valuable asset to the CF community. Regards, Josen _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Bell Sent: Thursday, June 07, 2007 3:44 PM To: cfcdev@cfczone.org Subject: Re: [CFCDEV] Application.cfc: where to set DSN +1. Only thing I put into application.cfc (in terms of a config property) is application.name which I need to include the framework that calls the application specific config bean that contains all of the other app specific config info. Encapsulating it in a config bean gives you a bunch more flexibility to change how it is created or stored without breaking the API you expose to the rest of your app. Best Wishes, Peter On 6/7/07 2:43 PM, Brian Kotek [EMAIL PROTECTED] wrote: 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: cfcdev@cfczone.org 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 http://www.katapultmedia.com http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org http://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 http://www.cfczone.org/listserv.cfm 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 http://www.katapultmedia.com http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://www.mail-archive.com/cfcdev@cfczone.org http://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 http://www.katapultmedia.com http://www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org http://www.mail