: www.scout7.com
-Original Message-
From: Dave Carabetta [mailto:[EMAIL PROTECTED]
Sent: 29 November 2004 17:47
To: CF-Talk
Subject: Re: Best way to access CFC's?
On Mon, 29 Nov 2004 12:39:35 -0400, Andy Mcshane [EMAIL PROTECTED]
wrote:
Starting to update a site by converting code to CFC's
(0)121 323 2010
Email: mailto:[EMAIL PROTECTED]
Website: www.scout7.com
-Original Message-
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: 29 November 2004 18:29
To: CF-Talk
Subject: Re: Best way to access CFC's?
CFINVOKE and createObject are very different beasts. CFOBJECT
]
Website: www.scout7.com
-Original Message-
From: Joe Rinehart [mailto:[EMAIL PROTECTED]
Sent: 29 November 2004 19:16
To: CF-Talk
Subject: Re: Best way to access CFC's?
If you're component is stateful, you'll want to invoke methods on the
same instance of the component instead
PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, November 30, 2004 4:28 AM
Subject: RE: Best way to access CFC's?
Thanks, that makes it a little clearer. Now for the newbie dumb
question, how does the code know where to find the components? i.e.
!--- Instantiate a component that adds
]
Website: www.scout7.com
-Original Message-
From: Deanna Schneider [mailto:[EMAIL PROTECTED]
Sent: 30 November 2004 13:19
To: CF-Talk
Subject: Re: Best way to access CFC's?
In that example, it will look in the directory of the calling template.
The
component part of the call tells
On Mon, 29 Nov 2004 12:39:35 -0400, Andy Mcshane [EMAIL PROTECTED] wrote:
Starting to update a site by converting code to CFC's, anyone have any
thoughts on what is the best or most efficient way to access a CFC? Is it
better to use CFInvoke or should I use CreateObject? Which method is
CFINVOKE and createObject are very different beasts. CFOBJECT and
createObject are the same, but CFINVOKE creates and instance of the
CFC, calls the specified method on it, and then lets the instance
disappear, with no hope of holding on to it for future reuse.
Here's two examples of creating an
On Mon, 29 Nov 2004 10:29:26 -0800, Barney Boisvert [EMAIL PROTECTED] wrote:
CFINVOKE and createObject are very different beasts. CFOBJECT and
createObject are the same, but CFINVOKE creates and instance of the
CFC, calls the specified method on it, and then lets the instance
disappear, with
Why would you do that?
-Original Message-
From: Sean Corfield.
Unless you specify a component *reference* in cfinvoke rather than a
component name:
cfset t = createObject(component, test) /
cfinvoke component=#t# method=testMethod returnvariable=r /
--
Sure enough. Can you tell I've never used CFOBJECT or CFINVOKE, ever?
I'm curious. Why would you want to type this:
cfinvoke component=#o# method=testMethod returnvariable=r
cfinvokeargument ... /
/cfinvoke
as opposed to this:
cfset r = o.testMethod(
...
) /
I know you hate my i
If you're component is stateful, you'll want to invoke methods on the
same instance of the component instead of continually creating new
instances.
!--- Instantiate a component that adds two numbers ---
cfset myAdder = createObject(component, addsTwoNumbers) /
!--- Set first number ---
cfinvoke
Why wouldn't I just state:
CFSET myAdder.setNumberOne(Number=2) /
This seems much more readable.
Andy
-Original Message-
From: Joe Rinehart [mailto:[EMAIL PROTECTED]
Sent: Monday, November 29, 2004 1:16 PM
To: CF-Talk
Subject: Re: Best way to access CFC's?
If you're component
We started off writing all our component method calls inline -- ie:
component.method(argument1, argument2), but we quickly found that
1. It was sometimes hard to follow what was going on due to the squished up
nature of the code.
2. Having to maintain the proper order of argument declaration
On Mon, 29 Nov 2004 10:29:26 -0800, Barney Boisvert [EMAIL PROTECTED] wrote:
CFINVOKE and createObject are very different beasts. CFOBJECT and
createObject are the same, but CFINVOKE creates and instance of the
CFC, calls the specified method on it, and then lets the instance
disappear, with
On Mon, 29 Nov 2004 11:05:44 -0800, Barney Boisvert [EMAIL PROTECTED] wrote:
I'm curious. Why would you want to type this:
cfinvoke component=#o# method=testMethod returnvariable=r
cfinvokeargument ... /
/cfinvoke
as opposed to this:
cfset r = o.testMethod(
...
) /
Me?
Do you know that you can name your arguments in the compenent.method(arg2=1,
arg1=2)?
-Original Message-
From: Matthew Drayer
We started off writing all our component method calls inline -- ie:
component.method(argument1, argument2), but we quickly found that
1. It was sometimes hard to
Barney Boisvert wrote:
CFINVOKE and createObject are very different beasts. CFOBJECT and
createObject are the same, but CFINVOKE creates and instance of the
CFC, calls the specified method on it, and then lets the instance
disappear, with no hope of holding on to it for future reuse.
What if
Thanks. I was wondering if you had some trick up your sleeve.
Andy
-Original Message-
From: Sean Corfield
On Mon, 29 Nov 2004 11:05:44 -0800, Barney Boisvert [EMAIL PROTECTED]
wrote:
I'm curious. Why would you want to type this:
cfinvoke component=#o# method=testMethod
2. Having to maintain the proper order of argument declaration was a pain
in the neck.
You can pass arguments by name when calling UDFs and component methods using
the dotted syntax:
cfset myObject = createObject(component, test)
cfset result = myObject.sayHello(message=Hello, name=ben)
I did not know that, no. Thanks for the tip.
Matt
Do you know that you can name your arguments in the compenent.method(arg2=1,
arg1=2)?
~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
CFINVOKE still isn't letting you hold onto the instance, it's via some
other external means. Yes it's splitting hairs. You could get around
it if the method serialized 'this' and stored it somewhere for later
recall as well.
cheers,
barneyb
On Mon, 29 Nov 2004 21:54:22 +0100, Jochem van Dieten
CFINVOKE and createObject are very different beasts. CFOBJECT and
createObject are the same, but CFINVOKE creates and instance of the
CFC, calls the specified method on it, and then lets the instance
disappear, with no hope of holding on to it for future reuse.
What if the method you
What about putting CFC's into the application scope? That way when calling one
CFC from another CFC, you don't need to use cfinvoke. You also can use it when
you do cfimport. Anyone have any experience doing something like that?
Bob Everland
23 matches
Mail list logo