Re: Core-Data : how to merge two contexts ?
Re: Core-Data : how to merge two contexts ?
- Subject: Re: Core-Data : how to merge two contexts ?
- From: Alexander Spohr <email@hidden>
- Date: Sat, 7 Nov 2009 02:08:40 +0100
Am 06.11.2009 um 17:52 schrieb Eric Morand:
What will happen with relationships ? Let's say we have a one-to-one
relationship between the Product entity and the Family entity and
that the user did affect a family (from the editing context) to the
newly created product (also in the editing context). How am I
supposed to establish the relationship back when I copy my product
object to the main context ? And what will happen if there is a one-
to-many relationship between the two entities ? Even worse : what f
I want to allow the user to create new families on the editing sheet
and he establish relationships between the object, the newly created
families and some families that were already in the main context ?
You copy nothing.
On save the changes are distributed to every other context that holds
the object.
If the object was never in the other context (esp. a new one) you have
to fetch it anyway. Or you get the NSManagedObjectID and ask the other
context for the object to that ID.
The relationships will just be there.
The NSManagedObjectContext is your scratchpad. If you want something
inside it fetch it or create it.
If you change something, the change will be promoted.
atze
_______________________________________________
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