using System.Data.Entity;
using Z.EntityFramework.Plus;
public static void Main()
AuditManager.DefaultConfiguration
.AuditEntryFactory = args =>
new AuditEntry() { CreatedDate = DateTime.Now.AddHours(-5) };
using (var context = new EntityContext())
context.Customers.Add(new Customer() { Name = "Customer_C", Description = "Description", IsActive = false});
audit.Configuration.AuditEntryFactory = args =>
new AuditEntry() { CreatedBy = "ZZZ Projects"};
context.SaveChanges(audit);
var entries = audit.Entries;
FiddleHelper.WriteTable("All Entry",entries);
foreach(var entry in entries)
FiddleHelper.WriteTable("Properties for One Entry",entry.Properties);
public class EntityContext : DbContext
public EntityContext() : base(FiddleHelper.GetConnectionStringSqlServer())
public DbSet<Customer> Customers { get; set; }
public int CustomerID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public Boolean IsActive { get; set; }