Wednesday, April 6, 2016

Tracking changes in a database in a .NET project

Java has a very neat package to do this, called torque. In .NET we're not quite there yet, so I highly recommend for .NET projects. Here are some things to keep in mind:

1) It will log all changes into only 2 (master-detail) tables (instead of having as many tables as entities as in torque).
2) You need to create those 2 tables manually, the schema is derived from screenshots in the wiki of the project (don't forget your PK's).
3) Setting it up is quite simple, only annotate the entities you want to track and inherit from TrackerContext instead of DbContext.

No comments: