30% OFF - 10th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY10
Entity Framework EFAuditing Discover How to Perform Auditing
Definition
EFAuditing is a library that implements Auditing for Entity Framework Core based DbContexts. It is extensible to allow other logging providers like MongoDB, Azure tables etc.
Derive you context from AuditDbContext.
public partial class MyContext : AuditingDbContext { public MyContext() : base("MyContextDB") { this.Configuration.LazyLoadingEnabled = false; } public DbSet<Customer> Customers { get; set; } public DbSet<Invoice> Invoices { get; set; } public DbSet<InvoiceItem> InvoiceItems { get; set; } }
Use the overloaded SaveChange(string userName) instead of the standard SaveChanges().
using (var context = new EnumTestContext()) { // code here context.SaveChanges("UserName"); }
Requirements
Entity Framework Version
- Entity Framework 6 or later.
ZZZ Projects