Re: Getting all managed objects of given entity
Re: Getting all managed objects of given entity
- Subject: Re: Getting all managed objects of given entity
- From: Charilaos Skiadas <email@hidden>
- Date: Sat, 9 Jul 2005 00:01:19 -0500
On Jul 8, 2005, at 11:54 PM, mmalcolm crawford wrote:
On Jul 8, 2005, at 9:45 PM, Charilaos Skiadas wrote:
Do I understand correctly, that if I want to get hold of all the
managed objects corresponding to a particular entity, I would need
to use a fetch request?
Yes (unless you're using an array controller -- see below).
I.e. there is no method of NSEntityDescription that would do it
for me automatically?
No. It would be trivial enough to write a category method :-)
+ objectsForEntityForName:inManagedObjectContext:
Yeah, I was about to do that, but I'll opt for talking to the
controllers that I already have doing the work for me. It would just
mean my document class would need to connect to them. Oh well.
I guess my question is what is the reason for the absence of the
method? Was it deemed not useful? Or is it in some sense recommended
to go through the controllers?
How does NSArrayController achieve the same thing?
It uses a fetch request. If you select "Automatically prepares
content" then the controller also registers as an observer of its
managed object context and responds to insertions and deletions as
appropriate.
I love it! Anything that involves less tedious work for me is great.
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