Re: Creating temporary NSManagedObjects
Re: Creating temporary NSManagedObjects
- Subject: Re: Creating temporary NSManagedObjects
- From: Quincey Morris <email@hidden>
- Date: Mon, 26 Apr 2010 12:01:01 -0700
On Apr 26, 2010, at 11:32, Joanna Carter wrote:
> If you are editing a list of objects, using a NSTableView, then one reason why you might not want to create temporary objects in the main context is that those objects get displayed in the NSTableView, even though you might not want them to be visible until the editing is finished.
>
> If you work with the trick of using a secondary context for editing, then you have to manage the copying of property values to/from the temporary object, including relationships, which have to be resolved from the original context.
>
> Which is why I use a temporary dictionary, because it allows me to freely interact with the property values, including relationships, without the need to work with a secondary context, as well as not affecting any UI components that might be displaying the original list.
Yes, I remember the discussion about this scenario: when the managed object represents a *future* permanent resident of the Core Data object graph. Outside of a discussion of that scenario, I wouldn't necessarily call this a "temporary" object.
In the OP's scenario, there is no suggestion he was trying to keep his temporary object out of the user interface. (In fact, his later clarification suggests the opposite.) That's why I was asking if the simple create it/delete it pattern wouldn't work.
_______________________________________________
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