Sunday, August 18, 2019

a simple example of an Entity Framework update

This is stolen from this.

using (var context = new SchoolDBEntities())
{
   var std = context.Students.First<Student>();
   std.FirstName = "Steve";
   context.SaveChanges();
}

 
 

Note that we are not attaching or adding the student to the context, not in this case.

No comments:

Post a Comment