Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core-Data : how to merge two contexts ?



Hi mmalc,

Thanks for your help.

This is what I feared : I have to copy manually the object from the editing context to the main one.

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 ?

Is this really the only solution ? It virtually destroy the whole "scratchpad" concept since it makes using contexts as scratchpad very difficult and error-prone with anything else than the simplest cases, like the one in the Apple tutorial.


Eric.




Le 6 nov. 2009 à 17:16, mmalc Crawford a écrit :


On Nov 6, 2009, at 8:09 am, Eric Morand wrote:

For example, let say that I want to be able to use a new context to deal with the creation of a new "product". I create a new editing context, insert a new product, open a new window and let the user fill the fields and click on Submit or Cancel. If the user clicks on Cancel, I release the editing context, if the user clicks on submit, I want to merge it with the 'main' context. That's where I'm stuck : how am I supposed to merge both contexts ?

This is illustrated in the documentation:
<http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/08_CreationSheet/creationSheet.html#//apple_ref/doc/uid/TP40001799-CH284-SW2 >


mmalc

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.