Re: Core Data modeling question
Re: Core Data modeling question
- Subject: Re: Core Data modeling question
- From: Markus Schneider <email@hidden>
- Date: Fri, 28 Nov 2008 21:15:07 +0100
Am 28.11.2008 um 07:06 schrieb Jerry Krinock:
On 2008 Nov, 27, at 8:11, Alexander Spohr wrote:
Am 26.11.2008 um 22:08 schrieb Markus Schneider:
Shall I use a MO class "DAY" and model the list as a to-many
relationship?
TASK
- startDate
- endDate
- exceptions -------------> DAY
- date
Is this really necessary or is there a more elegant way?
This IS the elegant way.
If you need an array use an own table for the destination and
connect it 1-n.
I'd like to offer another view on this. Yes, you could model the
list as a to-many relationship and yes this is the elegant way. And
it would also be the best way if all tasks had the same exceptions/
holidays, or if you might ever have a need to process exception/
holidays as entities on their own.
I thought on having a list of date objects containing the
exceptions. But how should I model this? I cannot create a
NSMutableArray to store the dates in the persistent store.
I wouldn't say "cannot". Certainly you cannot create a ^mutable^
array in a persistent store. But, although I have not tested this
yet, I believe that you can create an (immutable) array of dates by
setting its type to "transformable", and the default transformer
should work just fine. This might be a reasonable design if neither
of the conditions I stated in my first paragraph are true.
So, I believe you can model your exception/holidays as ^either^
attributes or relationships. But the latter is more elegant and
more amenable to adding new features in the future, while probably
costing about the same in design time and in program execution.
Alexander, Jerry,
thanks for your advice. I will go with the relationships model.
Markus
_______________________________________________
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