static void Main(string[] args) { using (var db = new ContosoUniversityEntities()) { db.Database.Log = (sql) => { Console.WriteLine(sql); }; //GetCourse_Git(db); //GetDepartment(db); //AddCourse(db); //UpdateCourse(db); //DeleteCourse(db); //示範實體狀態用法(db); //var c = db.Course.Find(1); //c.Credits += 1; //Console.ReadLine(); //db.SaveChanges(); //Console.ReadLine(); var data = db.GetCourse("%Git%"); foreach (var item in data) { Console.WriteLine(item.Title); } } }
static void Main(string[] args) { using (var db = new ContosoUniversityEntities()) { db.Database.Log = Console.WriteLine; //GetCourse_Git(db); //GetDepartments(db); //GetDepartmentsWithCourses(); //AddCourse(db); //UpdateCourse(db); //DeleteCourse(db); //ShowEntityStates(db); //SaveChangesWithEntityStates(db); var courses = db.GetCourse("%Git%"); foreach (var course in courses) { Console.WriteLine(course.Title); } } }