0

I want to implement audit log against each single record, so its looks like an history for records so user can view what operation perform against it,what is previous value? what is current value? like this, using a Repository pattern in MVC. Someone please help me.

Thank you.

1
  • Hello any one knows how to implement it?
    – Ganesh G
    Feb 4, 2016 at 4:48

1 Answer 1

1

Disclaimer: I'm the owner of the project EF+ (EntityFramework Plus)

You can use EF+ Audit which allow to easily track changes, exclude/include entity or property and auto save audit entries in the database.

// using Z.EntityFramework.Plus; // Don't forget to include this.

var ctx = new EntityContext();
// ... ctx changes ...

var audit = new Audit();
audit.CreatedBy = "ZZZ Projects"; // Optional
ctx.SaveChanges(audit);

// Access to all auditing information
var entries = audit.Entries;
foreach(var entry in entries)
{
    foreach(var property in entry.Properties)
    {
    }
}

Project: http://entityframework-plus.net/

Documentation: http://entityframework-plus.net/audit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.