stats101
stats101

Reputation: 1877

How would I audit a MVC3 .NET application?

I'm requiring a way to audit an MVC3 EF application capturing the following values:

I think I've wrongfully done the binding manually, and as a result all the row is updated after an edit (so trigger will assume everything is being updated)... therefore rather avoid DB triggers as it'll need a re-write of all the binding.

I would imagine, if I can capture the old values (somehow), and then compare to the new values, I can populate an audit table with the above fields.

Any advice on this would be much appreciated.

Upvotes: 1

Views: 585

Answers (2)

Ryand.Johnson
Ryand.Johnson

Reputation: 1906

You can subscribe to the saving changes event of the entity. Here is an example... Change History in MVC and EF

Upvotes: 0

TWith2Sugars
TWith2Sugars

Reputation: 3434

Depending on the version of SQL you using you could look in to Change Data Capture

Upvotes: 1

Related Questions