Re: a few Core Data questions: Predicates and document based app
Re: a few Core Data questions: Predicates and document based app
- Subject: Re: a few Core Data questions: Predicates and document based app
- From: mmalc Crawford <email@hidden>
- Date: Thu, 18 Dec 2008 11:04:28 -0800
On Dec 18, 2008, at 10:47 AM, Michael B Johnson wrote:
I have an entity (let's called it MyThing) that has an optional
parentThing relationship. I'm interested in MyThings that either
don't have their parent set, ("parentThing == NIL") or have their
parent set to themselves ("parentThing == SELF"). Do those predicate
forms sound right?
Yes, for more details see
<http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Articles/pUsing.html
> and
<http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdFetching.html
>
My other question is regarding the mundanity of doing a Core Data
document based app version versus an old skool Cocoa one, especially
one that used a file package for document storage.
I'm realizing that I have a lot of state in my document that's
specific to the document (i.e. not application settings). Normally,
these would be instance variables of my NSDocument subclass that I
would load/save as part of my document data.
It seems more Core Dataish, though, to make an NSManagedEntity to
hold these values, and then perhaps cache the values in a property
of the NSManagedDocument subclass as I open up.
It would probably be more appropriate to store this as metadata -- see
<http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/07_Metadata/chapter_8_section_2.html
> for an example of how to set metadata (this is for Spotlight
metadata, but the same principles apply). That would also cut the
Gordian Granny Knot of your other concerns.
mmalc
_______________________________________________
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