Merge changes between two Managed Object Contexts
Merge changes between two Managed Object Contexts
- Subject: Merge changes between two Managed Object Contexts
- From: Austin Grigg <email@hidden>
- Date: Sun, 21 Mar 2010 17:27:13 -0400
I've got a Core Data project and I have a window controlled by an NSWindowController that is used to add or edit an NSManagedObject. I wanted to create a separate Managed Object Context in the NSWindowController so that the changes made to the object aren't seen by the UI below and so I can just throw away the changes if the user clicks "Cancel". If the user clicks "Save' I wanted to merge the changes from the temporary MOC to the main MOC being used by the rest of the application.
What is the best way to merge those changes back to the main MOC? Do I have to recreate the object in the main MOC as is done in this example: http://www.timisted.net/blog/archive/multiple-managed-object-contexts-with-core-data? Or, can I use - (void)refreshObject:(NSManagedObject *)object mergeChanges:(BOOL)flag to merge the changes? If i use refreshObject:mergeChanges, can I pass it my NSManagedObject from the temporary MOC and do I need to call save: on the temporary MOC before doing that?
Thank you,
Austin_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden