Re: CORE DATA: derived values from several entities and managed object instances ??
Re: CORE DATA: derived values from several entities and managed object instances ??
- Subject: Re: CORE DATA: derived values from several entities and managed object instances ??
- From: dan pahlajani <email@hidden>
- Date: Tue, 24 Jan 2006 21:18:27 -0800
> > On Jan 18, 2006, at 2:54 PM, dan pahlajani wrote:
> > It seems like managed objects using core data to-many relationships use
> > "sets" and not "arrays".
> >
> It's not clear exactly what you mean here, or what the problem is.
>
> In Core Data, relationships (other than fetched relationships) are
> represented by sets, not arrays. Whether they were represented by
> sets or arrays, the principle for calculating the derived property
> would be the same. And what you return from an accessor method (for
> a derived property) is up to you...
>
> mmalc
To calculate values that are dependent on collections of objects and
object across related entities, I need access to ordered lists, to
access next and previous objects without performing a fetch (and next
and previous has to match what user is seeing in the UI). Is there a
way a managed object can access ordered lists so that it can calculate
all the values it needs. I can access a to-many relation but the
returned collection is an unordered set.
Someone on the Cocoa List responded to my question by saying, I could
set a "sortOrder" and do a fetch to receive"ordered" object set. I
think it is a sily solution. Why do I perform so many fetches (since
the there could be hundreds of calculations taking place involving
hundreds of objects) - it is absolutely inefficient especially when
all the objects are already there either owned by Core Data or by
Array and Tree Controllers. I understand the concept of uniquing but
still it seems inefficient to me.
Currently, I am accessing arrays from array controllers (using
key-value coding accessors) which is not elegant but works, I don't
like the fact that managed objects are aware of UI objects like array
controllers.
Thanks,
-Dan
_______________________________________________
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