Re: createPermId in DataContext

From: Dirk Olmes (dirk.olme..mx.de)
Date: Thu Nov 14 2002 - 21:57:40 EST

  • Next message: Andrus: "Re: ObjectId and objEntityName"

    Craig Miskell wrote:
    > We are implementing an automatic audit trail system, where we have our
    > own subclass of DataContext that overrides commitChanges. Before it
    > calls the super implementation of commitChanges, it checks for inserted,
    > updated and deleted objects, and creates audit records (also db objects
    > in the same context) for the changes.

    The checking of updated and deleted objects sounds like a generally
    useful feature to me.
    Is there a chance that we could make this a new feature of DataContext?
    I could imagine the following scenario:

    - User code call commitChanges on DataContext
    - DataContext iterates over all currently updated/inserted objects and
    sends them aboutToSave() (or whatever we'd like to name the method).
    This method could be defined in an interface which the DataObjects would
    have to implement. Alternatively we could poke around with reflection (hmm).
    - DataContext finally commits all the changes.

    This would make your implementation for the audit records posible as
    well as other uses.

    > Proposal: Modify createPermId to first check if the object has a
    > TempObjectId or not. If it's temporary, proceed. If not, assume it's
    > all ok and return immediately

    Sounds very sensible to me.

    -dirk



    This archive was generated by hypermail 2.0.0 : Thu Nov 14 2002 - 21:59:32 EST