Last post Jul 16, 2010 04:19 PM by sachin.shah
Jul 13, 2010 11:16 AM|bryanfok|LINK
I want to insert the createdBy, modifiedBy, createDate, modifiedDate columns in every database table for manage user activity.
This is the first time I try to do this. Is there a best practice I could follow?
I am thinking to do this in my business logic layer, and in every class's insert and update method i do something like this:
class.createDate = DateTime.Now;
class.modifiedBy = CurrentUser.Id;
class.createdBy = CurrentUser.Id;
Or there are much better way?
Jul 13, 2010 02:23 PM|sansan|LINK
You can create a class Activity with properties CreatedBy,ModifiedBy,CreateDate,ModifiedDate and
inherit all your classes from that activity class
and update your database tables to include those four columns as well
Jul 13, 2010 09:39 PM|jacobzhang|LINK
I suggest you should use TraceLog to manage user activity.
Jul 13, 2010 10:43 PM|bryanfok|LINK
But is there some drawback with your approach? One possible drawback I could think of making all my BO to inherit the Activity class
is that all of my business object could not inherit from any other class in the future.
Jul 13, 2010 11:27 PM|bryanfok|LINK
Interesting Info. Is TraceLog a different product?
Jul 16, 2010 04:19 PM|sachin.shah|LINK
I think we can use cookie/session. cookie/session can hold userid and we assign default system date in sql server for particular column.