Re: Core Data Questions
Re: Core Data Questions
- Subject: Re: Core Data Questions
- From: "David Wilson" <email@hidden>
- Date: Fri, 6 Jun 2008 20:39:39 -0400
On Fri, Jun 6, 2008 at 8:06 PM, Gordon Apple <email@hidden> wrote:
> Our data hierarchy has six objects, all of which inherit from "BaseList"
> which contains a dictionary (props) and an array (subList). These lists are
> chained (i.e., the six subclasses). So in the first-attempt data model,
> baselist.sublist is a one-to-many looping back to BaseList.
>
> However, the last item in the chain (Layer) needs it's subList to point
> to shapes instead of BaseList, i.e., subList is now a draw list. I could
> move subList into the subclasses, but there is a lot of recursive stuff
> going on in BaseList where it needs to be. Maybe I could just override an
> accessor so BaseList can get to it. Apparently, there's an issue calling
> "super" in managed objects, so I'll have to see if that poses any problems.
Is there a specific downside to having the Layer items simply have an
additional shapes to-many relationship? Layer objects will have an
empty subList relationship set, and instead populate a shapes
relationship. This has the advantage of being much more explicit. Your
problem seems generally to be an issue of trying to make one
relationship point to too many different things.
If you absolutely must do this, make BaseList and your shapes both
inherit from some entity, and point subList at that entity. I strongly
recommend against this, though. You'll save yourself trouble if you
just keep them separate.
--
- David T. Wilson
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden