Events

Oct 14, 2007 at 3:01 PM
Hello,
it would be great to have events like BeforeInsert/Update etc.

Or is there another way I can update a User Property in which the current Logged on User is saved to track who made the changes.

Best regards
Coordinator
Oct 15, 2007 at 2:32 AM
Edited Oct 15, 2007 at 2:34 AM
If you used DbObjectModel as base type, you can overide "Save" function to implements it:

public abstract User : DbObjectModel<User>
{
    public abstract string Name { get; set; }
 
    public override void Save()
    {
        if(this.Id == 0L)
            LogInsert();
        else
            LogUpdate();
        base.Save();
    }
}
Then when we call "Save" function by object like "u.Save();", the log function will be called.

If we use class DbEntry to save object like "DbEntry.Save(u);", the log function won't be called.

Attention: this feature need the recent check-in of source code.
Oct 15, 2007 at 10:22 AM
Thank you for the fast answer