generic database messages
MG:Unity - Calling your own custom reactor gateway methods using a Generic list
Submitted by Doug Sims on Wed, 2007-05-09 13:32. generic database messages | modelglue | reactorAre you guys using the ModelGlue generic list? A basic generic list (using reactor as the orm) calls the getByFields() method in the reactor gateway for the object you specify.
for example, if you broadcast this message in your eventhandler:
<message name="modelglue.genericList">
<argument name="object" value="user" />
<argument name="criteria" value="userID" />
</message>Would call getByFields(UserID={userIDValueInTheViewState})
and stuff the results into the viewstate.
Well, If you need complex query results (joins etc), you can specify the gateway method to call and modelglue will pass on the criteria as arguments to your custom method.
<message name="modelglue.genericList">
<argument name="object" value="user" />
<argument name="criteria" value="userID" />
<argument name="gatewayMethod" value="getUserInfo" />
</message>Then ModelGlue will take the results and stuff them into the viewstate just like any other generic list.
Chaining ModelGlue Generic Commit Events
Submitted by Doug Sims on Fri, 2006-07-14 19:42. coldfusion | generic database messages | modelglueI have really been loving the generic ORM stuff that is part of ModelGlue 2.0. I had been doing way to much work to stuff the objects we needed into the viewstate. Now I have been able to remove countless listeners and broadcasts I was using to get various objects when needed.
Now a generic read takes care of that.
The basic functionality of the generic events are documented at http://docs.model-glue.com so I wont get into how to use them, but one thing that isn't documented is how to handle updates to multiple unrelated objects in the same form post( event-handler)
Here is how I am doing it, It works like a charm for quick prototyping,as far as I am concerned.
Lets say I have 2 objects, Cinders and Ashes. I am collecting this data on the same form and I need to handle the validation and update the results. I need two generic commit message broadcasts
<message name="modelglue.GenericCommit">
<argument name="object" value="Cinder" />
<argument name="CinderId" value="Cinder" />
</message>and
<message name="modelglue.GenericCommit">
<argument name="object" value="Ashes" />
<argument name="AshesId" value="Ashes" />
</message>My form lives at an event called "CindersAndAshes.form" and submits to an event called


delicious
digg
reddit
technorati