Hi All,
I am experimenting with the data access pattern Sean Corfield provided in
the Designing Models section of the Mach-ii development guide
(articlemanager.cfc, article.cfc, articledao.cfc and articlegateway.cfc). I
have build a small Flash remoting app and tried to use all four of these
components. I am just interested in the data access pattern Sean suggested
and did not want to use the mach-ii framework. Because I am not using the
mach-ii framework the articleGateway and articleDao objects - see code
snippet from the articlemanager below - are not automatically created as
part of the framework setup. There is no Mach-ii framework in my case.
<cfcomponent extends="MachII.framework.Listener" displayname="Article
Manager" hint="I am the primary listener for the Active Content Resources
application">
<cffunction name="configure" access="public" returntype="void"
output="false" displayname="Listener 'Constructor'" hint="I initialize this
listener as part of the framework startup.">
<cfset var dsn = getParameter("dsn") />
<cfset var schema = getParameter("schema") />
<cfset variables.articleGateway =
createObject("component","acr.model.articlegateway").init(dsn,schema) />
<cfset variables.articleDAO =
createObject("component","acr.model.articledao").init(dsn,schema) />
<cfset variables.recentDays = getParameter("recentDays",7)
/>
</cffunction>
<cffunction name="getAllArticles" access="public" returntype="query"
output="false" displayname="Get All Articles" hint="I return a query
containing all of the published articles.">
<cfreturn variables.articleGateway.findAll() />
</cffunction>
</cfcomponent>
What is the best way to do this configuration without using the mach-ii
framework? Calling the configure method from the Flash application through
Flash Remoting? Use a separate CFC for all initialization? Use XML for
registering dsn and schema variables? Does anyone of you have some
"minimal-maintenance-oriented/best practice" sample code that does this job
in an elegant way. I really like the idea behind Sean's pattern but I am not
sure how to efficiently adapt it to a non-mach-ii scenario.
Thanks a lot.
Vinny
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words '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]