Daniel: Thank you! Insteresting, I would like to see a completed example for this.... If you have sometime???!! Could you write us an example of how it can be use.
Thanks Seng Ung -----Original Message----- From: Daniel Schmid [mailto:[EMAIL PROTECTED] Sent: Thursday, November 10, 2005 9:51 AM To: [email protected] Subject: Re: [CFCDev] sean: lesson of cfproperty? >2. It adds to the metadata for a CFC > This can be useful for documentation purposes or tools that depend >on introspection however I don't advise building systems that perform >dynamic introspection (at runtime) since they often don't scale very >well. maybe I get beaten to death, but I heavily use <cfproperty> for instrospection on a CMS system (not Farcry, even if I know it does it as well) my CFC content objects look like this... <cfcomponent displayname="ArticleObject" hint="This is the article"> <cfproperty name="title" type="string" default="New Article"/> <cfproperty name="subtitle" type="string" default="" /> <cfproperty name="teaser" type="longchar" default="" /> <cfproperty name="publishstart" type="date" default="" /> .... with getMetaData() I get all the properties and build a generic CRUD persistance layer around it. works since cf 6.0 like a charm... the use of cfproperty makes it somehow easy - otherwise I would have to write properies down in a xml-file (like hibernate does) regards daniel www.danielschmid.name Sean Corfield schrieb: >On 11/7/05, Ung, Seng <[EMAIL PROTECTED]> wrote: > > >>I am having a very tough time to understand what cfproperty does. >> >> > ><cfproperty> does two things: > >1. It describes public instance data in a CFC that is intended to be >the return type of a web service (or, in some cases, passed into a web >service). > Since CFML is essentially a typeless language, the <cfproperty> tag >provides information needed by the web service libraries to map >between a CFC and a strongly typed structure. Really this is just a >way to provide structs in CFML that have enough information associated >with them (metadata) to allow interaction with strongly typed web >services. > >2. It adds to the metadata for a CFC > This can be useful for documentation purposes or tools that depend >on introspection however I don't advise building systems that perform >dynamic introspection (at runtime) since they often don't scale very >well. > >In other words, most people actually won't need to use <cfproperty>. > >If you're calling a web service that returns a strongly typed >structure containing two elements (C++ syntax): > >struct Result { > double amount; > String currency; >} > >The equivalent CFML code would be: > >Result.cfc: ><cfcomponent> > <cfproperty name="amount" type="numeric"/> > <cfproperty name="currency" type="string"/> ></cfcomponent> > >The returned object would be used like this: > ><cfset result = ws.callMethod() /> ><cfset amount = result.amount /> ><cfset currency = result.currency /> > >(Caveat: all untested code off the top of my head - errors & omissions >excepted :) >-- >Sean A Corfield -- http://corfield.org/ >Got frameworks? > >"If you're not annoying somebody, you're not really alive." >-- Margaret Atwood > > >---------------------------------------------------------- >You are subscribed to cfcdev. To unsubscribe, send an email to >[email protected] with the words 'unsubscribe cfcdev' as the subject of the >email. > >CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting >(www.cfxhosting.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 words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.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 words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
