asp.net - Where should I manage the createdBy, modifiedBy, createDate, and modifiedDate? -


i want insert createdby, modifiedby, createdate, modifieddate columns in every database table manage user activity.

this first time try this. there best practice follow? design pattern manage this?

my first thought in business logic layer, , in every business classes' insert , update method, this:

class.createdate = datetime.now;

or

class.modifieddate= datetime.now;

class.modifiedby = currentuser.id;

or

class.createdby = currentuser.id;

or there better way?

bryan

this depends on types of business objects managing, , rules around create/modified data needed for. in cases, database audit trail, , there no need information in business logic layer. in case, information should live @ database level only. if using orm, might mean keep data objects anyway. if using stored procs, need know how take user name tag record with. datetimes can handled setting default value of getdate() on column.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -