示例#1
0
 static List <Student> Read()
 {
     using (var context = new EFDemoContext())
     {
         var std = context.Students.Where(x => x.Name == "Isco").ToList();
         Console.WriteLine(std.Select(x => x.Name).FirstOrDefault());
         return(std);
     }
 }
示例#2
0
 void Insert()
 {
     using (var context = new EFDemoContext())
     {
         var std = new Student()
         {
             Name = "Isco"
         };
         context.Students.Add(std);
         context.SaveChanges();
     }
 }