Entity Framework 5 Updating a Record

前端 未结 8 1276
悲哀的现实
悲哀的现实 2020-11-22 08:06

I have been exploring different methods of editing/updating a record within Entity Framework 5 in an ASP.NET MVC3 environment, but so far none of them tick all of the boxes

8条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 08:53

    You are looking for:

    db.Users.Attach(updatedUser);
    var entry = db.Entry(updatedUser);
    entry.Property(e => e.Email).IsModified = true;
    // other changed properties
    db.SaveChanges();
    

提交回复
热议问题