data access objects - separate out duplicate code to 'ta

Posted by agent_008_nl on 13-Jul-2012 06:58


Using autoedge|the factory as a startingpoint for our oo oera compliant framework, I have a question about the data access objects. Say I have a table with two parent-tables. For both parents I have defined a cascade delete in my ERD. When I want to maintain these tables I need two datasets, one for each parent (a child with more than one parent in a dataset produces an understandable runtime ABL error). I also need two data access objects. When I do not want to duplicate code, for example for delete restrictions on the childtable, I have to move the code for that in both data access objects  (the beforesavehandlers for the childtable) to another object that can be reached by the both data access objects (and who knows more in the future). Lets call it a tablehandler. This class should contain all dataset buffercallbacks for the childtable and the subscriptions to the events defined in the datasource.  The callback methods have some special objects as input parameters and should maybe delegate to methods like BeforeDeleteRow and AfterDeleteRow with only a bufferhandle as input , so that the logic can be invoked by other calls then the events.  How do you think about this/how did you solve this problem/what (callbacks or other code) have you delegated?

Regards, Stefan Houtzager.

All Replies

This thread is closed