Changeset 430
- Timestamp:
- 4/28/2008 9:09:50 PM (2 weeks ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
config/reactor.xml (modified) (1 diff)
-
reactor/core/objectFactory.cfc (modified) (3 diffs)
-
testDb.cfm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/config/reactor.xml
r410 r430 12 12 13 13 <objects> 14 <object name="Customer" >14 <object name="Customer" alias="foo5"> 15 15 <field name="customerId" alias="custId" /> 16 16 <field name="addressId" alias="addId" /> -
trunk/reactor/core/objectFactory.cfc
r397 r430 184 184 <cfset var generate = false /> 185 185 <cfset var DictionaryObject = 0 /> 186 <cfset var dictionaryXmlPath = "#getObject(arguments.alias).getMapping()#/Dictionary/#arguments.alias#dictionary.xml" /> 186 <cfset var tempmapping = "/" & Replace(getMapping(), ".", "/", "all") /> 187 <cfset var dictionaryXmlPath = "#tempmapping#/Dictionary/#arguments.alias#dictionary.xml" /> 187 188 <cfset var ObjectTranslator = 0 /> 188 189 … … 197 198 <cfset variables.Cache["Dictionary"][arguments.alias] = DictionaryObject /> 198 199 </cfif> 199 200 200 201 <cfcatch> 201 202 <!--- we only need the dbobject if it doesn't already exist ---> … … 233 234 <cfset var Object = 0 /> 234 235 235 <cfset Object = CreateObject("Component", "reactor.core.object").init(arguments.name, getConfig()) /> 236 237 <!--- read the object ---> 238 <cfset variables.ObjectDao.read(Object) /> 236 <!--- 237 this is a bit of a hack. See, within one request we might need to hit the DB several times to get the same config settings for one object. 238 we only want to hit the db once per that request. So, I'm using *shock* a request variable right here in a CFC. Deal with it! 239 ---> 240 <cfparam name="request.reactor.Object" default="#StructNew()#" /> 241 242 <cfif NOT StructKeyExists(request.reactor.Object, arguments.name)> 243 <cfset Object = CreateObject("Component", "reactor.core.object").init(arguments.name, getConfig()) /> 244 245 <!--- read the object ---> 246 <cfset variables.ObjectDao.read(Object) /> 247 248 <cfset request.reactor.Object[arguments.name] = Object /> 249 <cfelse> 250 <cfset Object = request.reactor.Object[arguments.name] /> 251 </cfif> 239 252 240 253 <!--- return the object ---> -
trunk/testDb.cfm
r410 r430 1 1 2 <cfset reactorFactory = CreateObject("Component", "reactor.reactorFactory") /> 3 <cfset reactorFactory.init("/config/reactor.xml") /> 2 <cfapplication name="reactorTest" /> 4 3 5 <cfset CustomerGateway = reactorFactory.createGateway("Customer") /> 4 <cfif NOT StructKeyExists(application, "reactorFactory") OR StructKeyExists(url, "reload")> 5 <cfset application.reactorFactory = CreateObject("Component", "reactor.reactorFactory") /> 6 <cfset application.reactorFactory.init("/config/reactor.xml") /> 7 <h1>reload</h1> 8 </cfif> 6 9 7 <cfset total = 0 /> 8 <cfloop from="1" to="30" index="x"> 9 <cfset tick = getTickCount() /> 10 <cfset CustomerGateway.test() /> 11 <cfset total = total + (getTickCount()-tick) /> 12 </cfloop> 10 <cfset CustomerRecord = application.reactorFactory.createRecord("foo5").load(custId=37) /> 11 <cfset CustomerRecord.validate() /> 13 12 14 avg: <cfdump var="#total/30#" />13 <cfdump var="#CustomerRecord#" />

