Seems to work, and only requests the
objects I want (rather than getting all first and then filtering). I
also have put in a conditional that the NSArray I am fetching into is
null so I don't repeatedly do the fetch.
Sounds like a good optimization if...
My only concerns are that I may be missing out on some WO magic, such
as the fetched array being refreshed (seems ok in testing though) and
that the EOEditingContext recognises the relationship between the
source and destination objects.
... you make sure to null this array out when things change. With a
regular WO app and attributes this is not too much of a problem.
Caching a
to-many relationship makes it much harder and I've no idea what
oddities
D2JC might throw into the mix.
If you are not using the default editing context and creating new
editing
contexts on a form by form basis you will probably be OK with what you
are
doing. Otherwise, imagine object A caching part of its to-many
relationship B. One of the B objects changes and because of that
change
should be added to or removed from the cached array. Object A has not
changed so no methods are going to get called on it that would allow
you to
release the cached values. You will also have to contend with objects
being added to or removed from the B relationship. All of this
situations
may occur in the same and other editing contexts.
Catching notifications is probably the best way to go about it. See
the
EOEditingContext docs for relevant notifications.