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

is there a yarn alternative for npm audit?

Yarn doesn’t have npm audit fix. But here’s how to do it by using npm – temporarily. Generate a package-lock.json file without installing node modules npm i –package-lock-only Fix the packages and update the package-lock.json file npm audit fix Delete the yarn.lock file and convert package-lock.json file into yarn.lock rm yarn.lock yarn import Delete the … 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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)