using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
public static void Main()
using (var context = new EntityContext())
context.Customers.Add(new Customer { Name = "John" });
FiddleHelper.WriteTable(context.Customers.ToList());
public class EntityContext : DbContext
public EntityContext() : base(FiddleHelper.GetConnectionStringSqlServer())
public DbSet<Customer> Customers { get; set; }
public int CustID { get; set; }
public string Name { get; set; }
public List<Invoice> Invoices { get; set; }
public int InvoiceID { get; set; }
public DateTime InvoiceDate { get; set; }
public int CustomerID { get; set; }
public Customer Customer { get; set; }