Menu

Advance auditing – audit every entity using EntityFramework-Plus

In one of my previous tutorials I talked about simple auditing, that records the Created By And Edited By user, but that is not enough in most cases. You will have to audit every entity, and what was the previous value and current value. This would be a real deal if you try to do it yourself, but I do not want to reinvent the wheel. That is where the EntityFramework-Plus audit comes handy.

In your DbContext define the audit entities.

Excluding auditing some fields from audit and audit only fields that has changed.

Now override SaveChanges()

Now this will audit every entity, every field that changed.

 

Leave a comment