コード例 #1
0
 /// <summary>
 /// 添加一个学生
 /// </summary>
 static void AddStudent()
 {
     using (EFDomeEntities context = new EFDomeEntities())
     {
         context.Database.Log = Console.WriteLine;
         context.Student.Add(new Student {
             age      = 13,
             name     = "lints",
             SchoolID = 1
         });
         context.SaveChanges();
     }
 }
コード例 #2
0
 /// <summary>
 /// 添加一个学校
 /// </summary>
 static void AddSchool()
 {
     using (EFDomeEntities context = new EFDomeEntities())
     {
         context.Database.Log = Console.WriteLine;
         context.School.Add(
             new School {
             name = "nf149"
         }
             );
         context.SaveChanges();
     }
 }