Menu

Simple audit using Override Entity Framework SaveChanges()

If you would like to implement a simple audit mechanism for your Entity Framework Entities, this is a good example. let say we will have ModifiedBy, ModifiedOn, CreatedBy, CreatedOn fields populated with logged in user.

Create a EntityBase.cs

each of your entity will inherit this base entity.

In your DbContext file set the override method like below.

 

Leave a comment