Re: "Detaching" a managed object.
Re: "Detaching" a managed object.
- Subject: Re: "Detaching" a managed object.
- From: Chris Hanson <email@hidden>
- Date: Mon, 12 Dec 2005 20:13:59 -0800
On Dec 12, 2005, at 6:36 PM, Jeff LaMarche wrote:
Does Core Data have a similar functionality?
Not exactly. You can however get a dictionary of the last committed
values for an object using -[NSManagedObject committedValueForKeys:].
Right now, I'm copying the fields I want to cache into an
NSDictionary, and it seems like more code than I should be writing,
but I'm concerned that if I copy the NSManagedObject, it will
create a copy in that NSManagedObject's context or give me a
shallow copy that will change if the original changes.
In fact, NSManagedObject doesn't support the NSCopying protocol, so
if you wanted a copyable managed object you'd have to implement that
feature yourself.
Is there a way to make a deep copy of an NSManagedObject that
doesn't exist in a context? Or is there another way to handle what
I'm doing other than copying the attribute values to a dictionary
(which somehow feels dirty :) )
I'm not sure what you would do with a managed object that's not
associated with a context. Can you describe a little more about the
higher-level goal you're trying to achieve?
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden