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: NSManagedObject Copy and Paste



I have a question regarding implementing copy and paste with
NSManagedObjects--

You're more or less on the right track. Here's an excerpt regarding moving values between threads which may help you with copy&paste:


At 8:22 AM -0700 3/1/06, email@hidden wrote:
The problem with insertions is that the brand new objects are not
accessible to other contexts until they are saved.  By accessible, I
mean semantically, as in their existence can't be communicated.
Until they are saved, the new objects don't have an identity (primary
key)

For updates and deletions, the objects have their permanent identity,
and you can use any of the standard Cocoa or OSX idioms for
communicating between threads to replicate those changes in a
different context.

Core Data doesn't have any additional routines for that.

However, Core Data offers the following on NSManagedObject:

- (NSDictionary *)committedValuesForKeys:(NSArray *)keys; - (NSDictionary *)changedValues;

Also, NSManagedObject is fully KeyValueCoding compliant, and KVC has
a number of handy methods for pushing and pulling batches of changes:

-(NSDictionary *)dictionaryWithValuesForKeys:(NSArray *)keys
- (void)setValuesForKeysWithDictionary:(NSDictionary *)keyedValues

--

-Ben
_______________________________________________

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.