Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData modeling a mutable attribute set for an entity




On Jan 3, 2006, at 10:30 AM, Jesse Grosjean wrote:

I'm trying to design a CoreData model that will allow my object to have a mutable set of associated attributes. My goal is to create a generic database record that will allow users to add their own attributes to. But I'm having a hard time with the design. In particular I'm having a hard time figuring out how to design things so that it's possible to query multiple attributes with a single NSPredicate.

Jesse -

I'm not 100% sure I understand what you're asking, but let me take a stab at it - let me know if I missed the point. :-) Fetch Requests , by their nature, have to work on a single entity. You can use the same predicate to create fetch requests for any entity that has the properties referenced in the predicate.

In a Fetch Requestion, you can, however, use any of an entity's properties - including its relationships, not just its attributes - so since you have a relationship from Entry to EntryAttribute, you can create a single predicate using keypaths based on the relationship name. So, using your example, you could create a format string something like:

entryAttributes.value = 'foo'

or

entryAttributes.value = $VALUE

If I understand what you want, that should work to allow you to fetch Entry entities based on the EntryAttributes it contains.

Hope this helps.
Jeff


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >CoreData modeling a mutable attribute set for an entity (From: Jesse Grosjean <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.