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 object instance:
<cfset i = createObject("component", "test") />
<cfobject action="create" type="component" name="i" class="test" />
And here's two examples of calling a method on a CFC, without creating
an instance:
<cfset r = createObject("component", "test").testMethod() />
<cfinvoke component="test" method="testMethod" returnvariable="r" />
cheers,
barneyb
On Mon, 29 Nov 2004 12:47:24 -0500, Dave Carabetta <[EMAIL PROTECTED]> wrote:
> 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
> > better and why?
> >
>
> They're effectively the same thing, except you'd use createObject if
> you're a cfscript fan and the tag-based cfinvoke if you're not.
>
> If you are new or relatively new to CFCs, be sure to check out this
> document which is a community-driven "best practices" document for
> working with them:
>
> http://www.dintenfass.com/cfcbestpractices/
>
> Regards,
> Dave.
>
--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/blog/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185553
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54