Posts

Showing posts with the label entityframework

Latest post

Update audit fields automatically using Entity Framework

I use this snippet to make sure I am always setting the audit fields globally so you can implement in one place and you are done with the auditing part. There's no need to set audit fields in every class. Pre-requisites: The following database table columns must be present in at least 1 database table: CreatedByUserID (int) CreatedDate (datetime) LastUpdatedByUserID (int) LastUpdatedDate (datetime) A DbContext has been generated for your database