Wednesday, August 6, 2014

Delete a record in an Entity Framework implementation.

public void DeletePerson(Person person)
{
   using (var db = new PersonContext())
   {
      db.People.Attach(person);
      db.People.Remove(person);
      db.SaveChanges();
   }
}

No comments:

Post a Comment