示例#1
0
        private static void DeleteStudentsFromClasses(ClassDB ctx)
        {
            var students = ctx.Students.ToList();

            foreach (var student in students)
            {
                ctx.DeleteObject(student);
            }
            ctx.SaveChanges();
        }
示例#2
0
        private static void DeleteClasses(ClassDB ctx)
        {
            var classes = ctx.Classes.ToList();

            foreach (var @class in classes)
            {
                ctx.DeleteObject(@class);
            }
            ctx.SaveChanges();
        }