Am Fr,26.09.2008 um 03:08 schrieb Jerry Krinock:

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.
If $user changes the name of one person, the names of the pets shouldn't be changed, too?

This "overkill" simply avoids redundancy to ensure consistency.

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.
This seems to be "overkill". ;-)

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?
Yes, because you get redundant and inconsistent model.

Cheers

Amin Negm-Awad
[EMAIL PROTECTED]




_______________________________________________

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]

Reply via email to