Re: Predicate Builder & Fetched Properties
Re: Predicate Builder & Fetched Properties
- Subject: Re: Predicate Builder & Fetched Properties
- From: Charilaos Skiadas <email@hidden>
- Date: Tue, 5 Jul 2005 15:04:28 -0500
On Jul 5, 2005, at 2:49 PM, mmalcolm crawford wrote:
On Jul 5, 2005, at 12:48 PM, Charilaos Skiadas wrote:
<http://developer.apple.com/documentation/Cocoa/Reference/
CoreData_ObjC/Classes/NSFetchedPropertyDesc.html>
If the values on which the result change (in this case, whether
the birthYear is changed because someone made a mistake, or you
add or remove People -- should be "Person"?), this is not
reflected in the fetched property unless you refresh the source
object.
So there is no way to get the refreshing to be done automagically
when a new People/Person is added/removed, or when the birthYear
is changed?
I have to admit, I would expect there would be an option one could
set, as to whether the property would be cached or not.
<<http://developer.apple.com/documentation/Cocoa/Reference/
CoreData_ObjC/Classes/NSFetchedPropertyDesc.html>
"The effect of a fetched property is similar to executing the fetch
request yourself and placing the results in a transient attribute,
although with the framework managing the details. In particular, a
fetched property is not fetched until it is requested, and the
results are then cached until the object is turned into a fault.
You use -refreshObject:mergeChanges: (NSManagedObjectContext) to
manually refresh the properties—this causes the fetch request
associated with this property to be executed again when the object
fault is next fired."
I've read this, but maybe I haven't fully understood it. So, if I
understand correctly, there are two options:
1) I can write code for the fetch request myself.
2) I can have any controller that changes things that affect the
given property call a refreshObject:mergeChanges: each time it
changes things.
It's this second option that I expected one could do through KVO,
without having to write any code. So I guess the question is: can one
register the fetched property to observe changes in some keys, and if
so what keys should they be in the above case, and where should this
code go? I certainly wouldn't want to tell each controller that
changes things that might affect the property to refresh the object.
But most importantly, why would one need to write code about this at
all? I guess maybe I've gotten too spoiled with CoreData, but I would
expect this to be exactly the sort of thing that CD would allow you
to do without any code.
It might very well be that I've seriously misunderstood something,
I've just recently started getting my head around CD. In that case,
please, feel free to direct me to RTFM, preferably with the
appropriate links.
On a related note, maybe I've missed it, but I haven't been able to
find a lot of examples on the web about how to use fetched properties
and fetch requests, so if someone can point me to some links, I would
appreciate it.
mmalc
Haris
_______________________________________________
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