Skip to content

Instantly share code, notes, and snippets.

@nunofilipecosta
Created September 12, 2013 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nunofilipecosta/6541646 to your computer and use it in GitHub Desktop.
Save nunofilipecosta/6541646 to your computer and use it in GitHub Desktop.
Entity Framework Update
public void Update(Entity currentEntity)
{
using(var db = new Context())
{
db.DbSet.Attach(currentEntity);
db.Entry(currentEntity).State = EntityState.Modified;
// V4
////context.ObjectStateManager.ChangeObjectState(currentEntity, EntityState.Modified);
db.SaveChanges();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment