static void addBlogValues() { using (var db = new ExistingEFDatabaseContext()) { db.Blog.Add(new Blog { Url = "https://google.com" }); db.Blog.Add(new Blog { Url = "https://yahoo.com" }); db.Blog.Add(new Blog { Url = "https://bing.com" }); db.Blog.Add(new Blog { Url = "https://myspace.com" }); db.Blog.Add(new Blog { Url = "https://shazam.com" }); var count = db.SaveChanges(); db.Dispose(); Console.WriteLine("{0} records have been added to the database.", count.ToString()); } prompt(); }
static void deleteBlogValues() { using (var db = new ExistingEFDatabaseContext()) { var allrecords = from x in db.Blog select x; db.Blog.RemoveRange(allrecords); var count = db.SaveChanges(); db.Dispose(); Console.WriteLine("{0} records have been removed to the database.", count.ToString()); } prompt(); }