Created
September 12, 2013 18:12
-
-
Save nunofilipecosta/6541646 to your computer and use it in GitHub Desktop.
Entity Framework Update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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