Re: Should I set Core Data dependent key in the primary's setter?
Re: Should I set Core Data dependent key in the primary's setter?
- Subject: Re: Should I set Core Data dependent key in the primary's setter?
- From: mmalcolm crawford <email@hidden>
- Date: Thu, 18 Aug 2005 02:23:31 -0700
On Aug 17, 2005, at 5:06 PM, Scott Ellsworth wrote:
The basic idea is that, any time Core Data tries to access the
transient attribute, it will call your getter, which will handle
the calculation.
Based on some experimentation, this does not work for a SQL store.
It appears that Core Data will not call the getter on the in-memory
objects when they have a transient attribute.
I added the tradeBetweenAlongRoute transient property, a float, to
my model, and marked it transient.
I added a sort descriptor on the key "tradeBetweenAlongRoute".
This descriptor works great when applied using
sortedArrayUsingPredicate, as the fetch is then in memory, but when
I did this against a saved SQL store, I got the error 'unknown
keypath tradeBetweenAlongRoute'
<http://lists.apple.com/archives/Cocoa-dev/2005/Aug/msg00797.html>
Please file a documentation enhancement request to cover this.
Am I overlooking something?
Perhaps, or perhaps my own knowledge is wrong. I had thought that
transient attributes were not kept in the persistent store, and
that fetch requests in a SQL store would be carried out against the
persistent data, thus making transient attributes inappropriate for
much of anything in a SQL store.
Transient attributes are still useful with a SQL store to represent
"non-standard" attributes (see <http://developer.apple.com/
documentation/Cocoa/Conceptual/CoreData/Articles/
cdNSAttributes.html>), and to represent other attributes that may be
cached to avoid expensive recalculation.
mmalc
_______________________________________________
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