I think you need to be a lot more descriptive or show some code if you want us to comment on it.
Matt Liotta President & CEO Montara Software, Inc. http://www.montarasoftware.com/ V: 415-577-8070 F: 415-341-8906 P: [EMAIL PROTECTED] > -----Original Message----- > From: Stacy Young [mailto:[EMAIL PROTECTED]] > Sent: Saturday, August 03, 2002 3:47 PM > To: CF-Talk > Subject: RE: cfreturn session.records ? > > Btw...guys please challenge this approach if it sounds ludicrous...I > haven't > been able to really bounce these ideas off anyone yet... > > Thanks for input, > > Stace > > -----Original Message----- > From: Stacy Young [mailto:[EMAIL PROTECTED]] > Sent: Saturday, August 03, 2002 6:41 PM > To: CF-Talk > Subject: RE: cfreturn session.records ? > > I wanted to keep any specific scope reference out of the display portion > of > the application because the data and scope is dependant on the user's > role.... a particular portion of users share the same data ( role A - app > scope ) while other groups have specific needs...(roles B,C,D - session > scope ) > > I have a generic CFC acting as my DAO...then I extend that for each > role...to apply specific biz logic for each role and store in the relevant > scope...( lets call these client components ) > > The fa�ade invokes the client component based on the users role...or if > it's > a remote call (no session exists) it invokes a client class which performs > an authentication routine before returning the resultset. > > This way I can re-use all this data management functionality in other apps > or platforms beyond the browser...(down the road)... > > I can't say this is the best way because honestly I don't know! Still > learning..and the examples on MM dev center aren't that in-depth on > server-side patterns. > > > Stace > > > -----Original Message----- > From: Stacy Young [mailto:[EMAIL PROTECTED]] > Sent: Saturday, August 03, 2002 6:28 PM > To: CF-Talk > Subject: RE: cfreturn session.records ? > > Well I'm extending a current CFC that returns an object (struct of > resultsets - no worries not for remote use) > > This wrapper CFC manages the resultset in session scope and carries a few > local methods I can execute on this subset of data...say for example I > wanted to re-sort one of the recordsets etc... > > Is that crazy ? > > > -----Original Message----- > From: Sean A Corfield [mailto:[EMAIL PROTECTED]] > Sent: Saturday, August 03, 2002 6:17 PM > To: CF-Talk > Subject: Re: cfreturn session.records ? > > On Saturday, August 3, 2002, at 02:58 , Stacy Young wrote: > > If I have a CFC that stores its results in session scope is the data > > duplicated on the return or is the session data just referenced via > > pointer > > of sorts? > > It uses reference semantics. However, it's not really good practice to > have CFCs store results in shared scopes - CFCs should be independent of > their environment. > > However, if the CFC stores things in session scope - why bother returning > them at all? Why not just let the caller access session.stuff directly? > > > <cffunction name="getAccounts"> > > You should add returntype="query" for extra validation. > > > <cfquery name="session.test"> > > SELECT * FROM BLAH > > </cfquery> > > <cfreturn session.test> > > </cffunction> > > You'd be better off having the caller (only) know about the session scope > and using a local variable inside the function: > > <cfset var test = 0/> > <cfquery name="test"> > SELECT * FROM BLAH > </cfquery> > <cfreturn test/> > > Then the caller would do: > > <cfinvoke component="accounts" > method="getAccounts" > returnvariable="session.aQuery"/> > > if you wanted it to stay in session scope (the query is not copied, only a > reference to it, so this is fast). Or, if you just wanted a local copy: > > <cfinvoke component="accounts" > method="getAccounts" > returnvariable="aQuery"/> > > Note that since 'test' inside the function is declared with 'var', it will > be a new copy for every invocation. > > "If you're not annoying somebody, you're not really alive." > -- Margaret Atwood > > > > > ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

