static void Cleanup() { using (var context = new EFRecipesEntities()) { context.ExecuteStoreCommand("delete from chapter5.movie"); context.ExecuteStoreCommand("delete from chapter5.category"); } }
static void Cleanup() { using (var context = new EFRecipesEntities()) { context.ExecuteStoreCommand("delete from chapter11.webcustomer"); context.ExecuteStoreCommand("delete from chapter11.zip"); } }
static void Cleanup() { using (var context = new EFRecipesEntities()) { context.ExecuteStoreCommand("delete from chapter6.refurbishedtoy"); context.ExecuteStoreCommand("delete from chapter6.toy"); } }
static void Cleanup() { using (var context = new EFRecipesEntities()) { context.ExecuteStoreCommand("delete from chapter13.[transaction]"); context.ExecuteStoreCommand("delete from chapter13.creditcard"); context.ExecuteStoreCommand("delete from chapter13.customer"); } }
static void Cleanup() { using (var context = new EFRecipesEntities()) { context.ExecuteStoreCommand("delete from chapter10.product"); } }
static void Cleanup() { using (var context = new EFRecipesEntities()) { context.ExecuteStoreCommand("delete from chapter3.organization"); } }
static void RunExample() { using (var context = new EFRecipesEntities()) { context.ExecuteStoreCommand(@"insert into chapter6.toy (Name,ForDonationOnly) values ('RagDoll',1)"); var toy = new Toy { Name = "Fuzzy Bear", Price = 9.97M }; var refurb = new RefurbishedToy { Name = "Derby Car", Price = 19.99M, Quality = "Ok to sell" }; context.Toys.AddObject(toy); context.Toys.AddObject(refurb); context.SaveChanges(); } using (var context = new EFRecipesEntities()) { Console.WriteLine("All Toys"); Console.WriteLine("========"); foreach (var toy in context.Toys) { Console.WriteLine("{0}", toy.Name); } Console.WriteLine("\nRefurbished Toys"); foreach (var toy in context.Toys.OfType <RefurbishedToy>()) { Console.WriteLine("{0}, Price = {1}, Quality = {2}", toy.Name, toy.Price, ((RefurbishedToy)toy).Quality); } } Console.WriteLine("Press <enter> to continue..."); Console.ReadLine(); }