Setting a user stamp on objects

From: Derek Rendall (cayenn..sure.com)
Date: Sun Dec 05 2004 - 17:02:26 EST

  • Next message: Jürgen Saar: "Re: Setting a user stamp on objects"

    Hi

    I have a database where each table has a field that stores the user who last
    updated the record. In our current apps we pass around an object that
    contains the user information and set the field in the objects as part of
    the save process. I would prefer it if I could hide and aoutomate this. I
    can see several possible ways of handling this, but am not sure which is the
    most appropriate.

    (1) Create a subclass of DataContext which can store User Info. I could
    create this via my own factory method, pass it the user details. Then in a
    superclass of all my objects I could override validateForSave and grab the
    user information from my data context and set it as appropriate. After
    having a look at DataContext I'm not sure that this is a "stable" approach
    (for one thing, the EventSubject instances are final and use the DataContext
    class). Adding a map of "constant" information to the Data Context might be
    a nice addition?

    (2) I would love it if the Delegate helped me out, but it doesnt seem to
    have an entry that matches where I want to "interrupt" the process.

    (3) Using the DataContext events - WILL_COMMIT in particular. However, the
    quote from an entry in the lists "Re: EventSubjects" dated Wed Jul 21
    2004 - 16:13:34 has the following comment by Andrus that makes me nervous
    that this approach is a "second class citizen":

    " Another place is DataContext events. I wasn't a big fan of it when this
    was originally submitted, now and seems more useful to me (still I am
    looking to redesign this some more in the future :-))... "

    Any advice or clarification would be most appreciated.

    Thanks

    Derek



    This archive was generated by hypermail 2.0.0 : Sun Dec 05 2004 - 17:02:37 EST