Re: CoreData modeling a mutable attribute set for an entity
Re: CoreData modeling a mutable attribute set for an entity
- Subject: Re: CoreData modeling a mutable attribute set for an entity
- From: Jeff LaMarche <email@hidden>
- Date: Tue, 3 Jan 2006 10:50:55 -0500
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:
This email sent to email@hidden