• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Should I set Core Data dependent key in the primary's setter?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Scott Ellsworth <email@hidden>
  • Date: Thu, 18 Aug 2005 09:11:58 -0700


On Aug 18, 2005, at 2:23 AM, mmalcolm crawford wrote:


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>

The sad thing is that I remember reading that post, but had forgotten it when composing my reply.


Please file a documentation enhancement request to cover this.

Will do.

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.

That came across harsher than I intended - apologies.

A better phrasing might have been 'transient attributes are only appropriate in a SQL store for attributes to be used in-memory, or the special cases mentioned in <cdNSAttributes.html>. Those special cases do make sense, and I even have a few; they are just not what I need to do for my current application.

Scot
_______________________________________________
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


References: 
 >Re: Should I set Core Data dependent key in the primary's setter? (From: Bill Cheeseman <email@hidden>)
 >Re: Should I set Core Data dependent key in the primary's setter? (From: Scott Ellsworth <email@hidden>)
 >Re: Should I set Core Data dependent key in the primary's setter? (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: Launching other app with iTunes?
  • Next by Date: Re: Do I need to release IBOutlets in dealloc?
  • Previous by thread: Re: Should I set Core Data dependent key in the primary's setter?
  • Next by thread: CoreData: sporadically messages zombie when adding persistent xml store?
  • Index(es):
    • Date
    • Thread