Usually I'm using this code
Member member = ctx.Members.Find(id);
member.Name = txtName.Text;
ctx.Entry(member).State = EntityState.Modified;
ctx.SaveChanges();
When I want to update the model using entity framework. I found an example on SO that doesn't use EntityState.Modified
to update the model. I try to remove the line and it's still working. What is the pros and cons use EntityState.Modified
and doesn't use EntityState.Modified
?
Notes: I'm using Entity Framework 6 Code First in WinForms