Friday, May 20, 2005

[Opf3] "Own" the persistent object

Opf3 offers a few features to "own" a persistent object. Those features are interfaces that have to be implemented by the persistent object.

The first interface (and also the most important) is: IObjectNotification. This interface contains methods that are invoked before an action is going to happen and after the action has happened. This interface allows you to modify the object or build some verification code into your persistent object that is invoked before or after an action. The actions supported are:
  1. Delete,
  2. Insert,
  3. Update,
  4. Populate (before and after the object is populated with data) and
  5. MarkDeletion (before and after an object is marked to be deleted).

Another interface, that allows specify how an object is populated, is the IPopulateHelper interface. This interface allows the persistent object to populate itself. It's easy to implement it and you get for each column of the table the name and the data. It's then up to the object to populate itself.


Post a Comment

<< Home