using System.Collections.Generic;
using System.Data.Entity;
using Z.EntityFramework.Classic;
public class EntityContext : DbContext
public EntityContext() : base(FiddleHelper.GetConnectionStringSqlServer())
this.Configuration.Audit.AutoSaveSet = this.AuditEntries;
this.Configuration.Audit.IsEnabled = true;
public DbSet<Customer> Customers { get; set; }
public DbSet<AuditEntry> AuditEntries { get; set; }
public static void Main()
using (var context = new EntityContext())
context.Customers.Add(new Customer() { Name = "Customer_A", Description = "Description" });
FiddleHelper.WriteTable("1 - Audit Entries", context.AuditEntries.Where<Customer>().ToList());
FiddleHelper.WriteTable("2 - Audit Properties", context.AuditEntries.Where<Customer>().ToList().SelectMany(x => x.Properties));
public int CustomerID { get; set; }
public string Name { get; set; }
public string Description { get; set; }