using System.Collections.Generic;
using System.Data.Entity;
using Z.EntityFramework.Classic;
public class EntityContext : DbContext
public EntityContext() : base(FiddleHelper.GetConnectionStringSqlServer())
this.Configuration.Audit.IsEnabled = true;
public DbSet<Customer> Customers { get; set; }
public static void Main()
using (var context = new EntityContext())
List<Customer> customers = new List<Customer>();
customers.Add(new Customer() { Name = "Customer_A", Description = "Description" });
customers.Add(new Customer() { Name = "Customer_B", Description = "Description" });
context.Customers.Add(new Customer() { Name = "Customer_A", Description = "Description" , Customers = customers});
FiddleHelper.WriteTable("Entity Framework - Get ALL Parent", context.Configuration.Audit.LastAudit.Entries.Select( x => x.Parent).ToList());
FiddleHelper.WriteTable("Entity Framework - Get ALL Entries of Parent", context.Configuration.Audit.LastAudit.Entries.SelectMany( x => x.Parent.Entries.ToList()).ToList());
public int CustomerID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public List<Customer> Customers { get; set; }