views:

140

answers:

1

Is there a way to save changes for individual tracked objects rather than all the objects in the ObjectStateManager, and I mean something like:

ObjectContext.SaveChanges(Contact)
+3  A: 

Maybe you could create two different contexts and save one set of objects at a time rather than the whole lot? Could you detach the object in question from your main context, attach it to another context and save that context? I know that it can get very messy working with multiple contexts however!

Calanus
I am using EF in a Windows application, which has almost the entire app's life time.
Shimmy
I know it is tempting to keep a single context for the life of the app (and I've done it myself) but you should try and restrict the life of the context as much as possible (see http://stackoverflow.com/questions/457369/should-i-share-the-entity-framework-context-or-create-a-new-context-for-each-oper)
Calanus
I sympathise though because working with multiple objext contexts is horrible - ugh!
Calanus
@Calanus, oh yea!!I guess I will find a different solution, cuz I am not planning to work with multiple contexts here.Besides, I am working almost synchronized, i.e. I am saving data very often, it's not that I have million dirty objects in one side.
Shimmy