• 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: Core Data : Searching using transient attributes as criteria
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data : Searching using transient attributes as criteria


  • Subject: Re: Core Data : Searching using transient attributes as criteria
  • From: Chris Hanson <email@hidden>
  • Date: Mon, 5 Jun 2006 01:50:51 -0700

On Jun 5, 2006, at 1:31 AM, Eric Morand wrote:

I suppose I have to stop using transient properties, they seem less an less useful to me every new day (they mark the database as dirty when they are modified BUT they can't be used in predicates; they are part of the database on one side, but not on the other side).

Your statement above is a little imprecise. In Core Data, it doesn't make sense to say anything can "mark the database as dirty." Neither is it the case that transient properties "can't be used in predicates."


Manipulating a transient property of a managed object will mark the managed object context it is associated with as having unsaved changes. This is quite different than "the database" — by which I suspect you mean "the persistent store" — a managed object context is a scratchpad. You might not care that it has unsaved changes. You might care that it has unsaved changes because you might be converting your transient attribute to a persistent representation when the managed object is sent -willSave. Or, you might wish to undo your changes; transient properties fully support undo.

Transient properties are also fully supported in predicates, generally speaking. That is, if you have an array of managed objects that have a transient property, you can filter that array using a predicate. Similarly, you can evaluate a predicate that references a transient property directly against an object just fine. What you can't do is execute a fetch request that references a transient property. The reason is that getting the actual value of a transient property requires instantiating a managed object; otherwise, how is the managed object context supposed to know what the actual value of the transient property should be?

If you think about it in this way, the restrictions on how transient properties can be used make quite a bit of sense. And even given these restrictions, they're extremely useful.

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


  • Follow-Ups:
    • Re: Core Data : Searching using transient attributes as criteria
      • From: Eric Morand <email@hidden>
References: 
 >Core Data : Searching using transient attributes as criteria (From: Eric Morand <email@hidden>)
 >Re: Core Data : Searching using transient attributes as criteria (From: mmalcolm crawford <email@hidden>)
 >Re: Core Data : Searching using transient attributes as criteria (From: Eric Morand <email@hidden>)

  • Prev by Date: Re: Core Data : Searching using transient attributes as criteria
  • Next by Date: Re: BigNerdRanch Cocoa Bootcamp
  • Previous by thread: Re: Core Data : Searching using transient attributes as criteria
  • Next by thread: Re: Core Data : Searching using transient attributes as criteria
  • Index(es):
    • Date
    • Thread