When I first looked at Core Data, I saw that there was no such
attribute type as "Array" or "Set", and concluded that collections
must be modelled as relationships. This would be overkill in many
cases, for example, in a Person type of application if you wanted to
list the names of each Person's pets, but had no interest in the pets
themselves.
So, one way I worked around this was to store the pet names as an
attribute petNamesString of type String, using a delimiter character,
and transforming on the way in and out of the store. But now I find
there is an even more natural way, which is to just leave them as a
set or array, and store in an attribute of type Transformable. The
default transformer en/decodes the collection into/from an NSData, and
everything "just works".
I'm surprised that I've never seen this discussed or documented. Is
this going to get me into any trouble?
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]