• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core Data modeling question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data modeling question


  • Subject: Re: Core Data modeling question
  • From: Jerry Krinock <email@hidden>
  • Date: Fri, 28 Nov 2008 15:02:51 -0800


On 2008 Nov, 28, at 12:15, Markus Schneider wrote:

thanks for your advice. I will go with the relationships model.

Well, one more thing, and this is directed to others, not you Markus. In a project I am working on, I too have an managed object Foo with a property that is a set in my case a set of of strings. I have two choices for modelling this property:
* model the set of strings directly as an attribute, of type transformable
or
* model the set of strings as a a to-many relationship of 'bars' to an entity Bar of class NSString.


The, latter, the "elegant" choice, does have a disadvantage when I want to make a copy/insert a Foo from one managed object context into a different managed object context.

If it's an attribute, it simply gets copied with all the other attributes when I enumerate over -[NSEntityDescription attributesByName].

But if it's a to-many relationship, I need to write and maintain additional code in my -copy method. This additional code must enumerate over the bars of the foo, copy/insert new Bars and wire up the relationships.

So, I would say that the choice is indeed worth considering in each application. Modelling as a to-many relationship is not always better than modelling as an transformable attribute.

_______________________________________________

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


References: 
 >Core Data modeling question (From: Markus Schneider <email@hidden>)
 >Re: Core Data modeling question (From: Alexander Spohr <email@hidden>)
 >Re: Core Data modeling question (From: Jerry Krinock <email@hidden>)
 >Re: Core Data modeling question (From: Markus Schneider <email@hidden>)

  • Prev by Date: Re: Problem with binding of @count
  • Next by Date: NSMutableArray vs NSArrayController
  • Previous by thread: Re: Core Data modeling question
  • Next by thread: Using a string as filepath
  • Index(es):
    • Date
    • Thread