Re: Core-Data Multithreading question about save
Re: Core-Data Multithreading question about save
- Subject: Re: Core-Data Multithreading question about save
- From: Dex Morgan <email@hidden>
- Date: Thu, 22 May 2008 00:36:03 +0200
Il giorno 22/mag/08, alle ore 00:18, Hamish Allan ha scritto:
Not sure I understand your question, but if you need to differentiate
between objects inserted before some point in time and objects
inserted afterwards, you can explicitly model a timestamp in a managed
object subclass. See e.g.,
http://developer.apple.com/cocoa/coredatatutorial/index.html, movie
I'll try to explain it better.
Suppose an existing persistent store with some objects inside.
When you open the app you can see these objects from the main
managedobjectcontext.
Now suppose you have a thread that will put in backgrounds lots of
objects.
The programs itself store each object inside another
managedobjectcontext (linked to the same persistent store) and then
search for an object (we call it the parent of this object) to make a
relationship.
This link actions happend in the main thread (so inside the main
object context) and the app can't see objects inserted into the second
managedobject until I perform a -save: to it.
However it seems to be a damn expensive operation (a save for each
inserted object I mean) and I think it's not the right way to perform
my target.
Hope it is clear.
_______________________________________________
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