Core Data: Copying and pasting chained entities
Core Data: Copying and pasting chained entities
- Subject: Core Data: Copying and pasting chained entities
- From: Renaud CĂ©roce <email@hidden>
- Date: Tue, 30 Sep 2008 16:25:44 +0200
Hi everyone,
I was not able to find any answer either on this list or on the web
although I thought it must be a common interrogation (my question must then
be very silly, I suppose).
My program uses Core Data to maintain Figures.
- A Figure has a FillStyle.
- A FillStyle has a FillColor (or has not).
All all these are entities, implemented as subclasses of NSManagedObject.
I have followed the example given in the Core Data Persistent Document
tutorial
(http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/05_CopyAndPaste/chapter_6_section_3.html)
This example provides a simplistic example, with a single entity. It worked
so far to copy and paste Figures, but once a Figure is inserted into the
graph (using +[NSEntityDescription
insertNewObjectForEntityForName:inManagedObjectContext:]), the FillStyle
and the FillColor are filled with their default values, like on an ordinary
creation. My problem is therefore to archive the FillStyle and the
FillColor along with the Figure, and be able to recreate the graph of
objects.
I've never used either NSCoder nor NSArchiver before, but they don't seem
to be an answer to my problem here, as they deal with graphs of Objective-C
objects. However, I would have to code a very similar solution. And that
would be inefficient to insert entities in the graph, and replace their
default values with the copied ones, for something very akin to fetching
entities.
Any suggestion ?
(I need to support Mac OS 10.4).
Thanks in advance.
Renaud Pradenc
--------------
ceroce.com
_______________________________________________
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