Hi all

I'm looking for comments about cfc instantiation and the best
practices for cflock.

Please look this code used in my application.

When user enters in application i call a cfc.

In application.cfm:
-----------BEGIN application.cfm---------------
<cfif not isDefined('session.Instantiated')>
<cfset session.ComponentVar =
createObject("component","components.app").init()>
<cfset session.qryAllProducts = session.ComponentVar.getAllProducts()>  
several cfset with session variables related to all SELECT queries in cfc
</cfif>
-------------END application.cfm--------------

In app.cfc:
---------------BEGIN app.cfc-----------------------
<cfcomponent output="false">
<cfset init()>
<cffunction name="init" access="public">
<cfreturn this>
</cffunction>
<cffunction name="getAllProducts" output="false" access="public"
hint="Get all products" returntype="query">
arguments list
<cfquery name="qryAllProducts" datasource="#application.DSN#">
SELECT
....
FROM
Products
</cfquery>
<!--- query is loaded to session scope --->
<cfset session.qryAllProducts = qryAllProducts> 
<cfreturn session.qryAllProducts>
</cffunction>
several CRUD operations
</cfcomponent>
----------------END app.cfc---------------------

- This(using cfc in session scope) is a best practice?
- Need cflock? Where?
- It's possible to optimize this application? How?

Any help will be very appreciated.

Cheers

MD

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222662
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

Reply via email to