Best design for a changelog / auditing database table? [closed]

In the project I’m working on, audit log also started from the very minimalistic design, like the one you described: event ID event date/time event type user ID description The idea was the same: to keep things simple. However, it quickly became obvious that this minimalistic design was not sufficient. The typical audit was boiling … Read more

Implementing Audit Log / Change History with MVC & Entity Framework

IF you are using EF 4 you can subscribe to the SavingChanges event. Since Entities is a partial class you can add additional functionality in a separate file. So create a new file named Entities and there implement the partial method OnContextCreated to hook up the event public partial class Entities { partial void OnContextCreated() … Read more

Entity Framework 6: audit/track changes

If using EF6’s DbContext you can use ChangeTracker in SaveChanges override to find added/modified entities of custom type, for example IAuditedEntity. public interface IAuditedEntity { string CreatedBy { get; set; } DateTime CreatedAt { get; set; } string LastModifiedBy { get; set; } DateTime LastModifiedAt { get; set; } } public override int SaveChanges() { … Read more