Thanks... For some reason I should have known that :)

Phillip 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Nathan Dintenfass
Sent: Tuesday, October 21, 2003 4:11 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Duplicate() and CFCs

Duplicate will not work on CFC instances in CF 6.1.

If you need to duplicate instances of a CFC you will need to write your own
clone() method.

One side comment: since locking issues for protection of memory integrity
are no longer a problem in CFMX you probably don't need to make a duplicate
of the application scope (which became a common practice in CF 4.5/5).





> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Phillip Cave
> Sent: Tuesday, October 21, 2003 2:07 PM
> To: [EMAIL PROTECTED]
> Subject: [CFCDev] Duplicate() and CFCs
>
>
>
> Hello.
>
> I'm working with a component that is stored in application scope. When 
> a
> duplicate() of the application scope is performed like in the code 
> below, I get an error that says the variable 'instance' is not defined 
> when I try to run request.app.objSQLServerDAOFactory.dump(). Calling
> application.objSQLServerDAOFactory.dump() works fine.
>
> lock
> application.objSQLServerDAOFactory =
> application.objDAOFactory.init(application.objDAOFactory.SQLServer);
> request.app = duplicate(application);
> /lock
>
> However, if duplicate is not used as in request.app = application; 
> then running request.app.objSQLServerDAOFactory.dump() runs as expected.
>
> Can someone explain to me why this is? I'm know duplicate() does a 
> deep copy and assigning the value directly just gives you a reference 
> to the original variable.
>
> SQLServerDAOFactory Code
> --------------------------------------------
> <cfcomponent displayname="SQLServerDAOFactory" hint="Creates SQL 
> Server DAO components">
>
>       <cfset init()>
>
>       <cffunction name="init" access="package" output="false"
> returntype="void">
>               <cfset instance = structnew()>
>               <cfset instance.datasource = "">
>       </cffunction>
>
>       <cffunction name="getPageDAO" access="public" output="false"
> returntype="PageDAO">
>               <cfset obj = createobject("component", "PageDAO")>
>               <cfset obj.setDatasource(instance.datasource)>
>               <cfreturn obj>
>       </cffunction>
>
>       <cffunction name="setDatasource" access="package" output="false"
> returntype="void">
>               <cfargument name="datasource" type="string" required="yes">
>               <cfset instance.datasource = arguments.datasource>
>       </cffunction>
>
>       <cffunction name="dump" access="public" output="true"
> returntype="void">
>               <cfdump var="#instance#">
>       </cffunction>
>
> </cfcomponent>
>
> Thanks,
> Phillip
>
> --
>
> Phillip Cave
> Director, ColdFusion Development
> Macromedia Certified ColdFusion Developer Carol/Trevelyan Strategy 
> Group
> 202.448.5212
> >

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool,
Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to