private static void DeleteDatabase2() { using (var context = new BooksContext2()) { context.Database.EnsureDeleted(); } Console.WriteLine("database deleted"); }
private static void CreateDatabase2() { using (var context = new BooksContext2()) { context.Database.EnsureCreated(); context.Books.Add(new Book("Professional C# 7 and .NET Core 2.0", "Wrox Press", "Christian Nagel")); context.SaveChanges(); } }
private static void CreateDatabase2() { using (var context = new BooksContext2()) { context.Database.EnsureCreated(); context.Books.Add(new Book("Professional C# 6", "Wrox Press")); context.SaveChanges(); } }
private static void ReadData2() { using (var context = new BooksContext2()) { foreach (var book in context.Books) { Console.WriteLine(book); } } }