What does the DBContext.Entry do? What does the DBContext.Entry do? asp.net asp.net

What does the DBContext.Entry do?


It just attaches the entity to the dataContext. Otherwise you will have to search for the entity using the primary key and then edit the value and save it.

If you have an entity that you know already exists in the database but to which changes may have been made then you can tell the context to attach the entity and set its state to Modified. http://msdn.microsoft.com/en-US/data/jj592676