Re: Xcode's New Data Model reads ivars as attributes ?!?
Re: Xcode's New Data Model reads ivars as attributes ?!?
- Subject: Re: Xcode's New Data Model reads ivars as attributes ?!?
- From: Chris Hanson <email@hidden>
- Date: Sun, 09 Nov 2008 17:14:36 -0800
Core Data can use instance variables as storage for attributes (and
relationships) instead of managing the storage itself. This is
discouraged though because it doesn't buy you anything as a developer
- in fact, it can be more efficient for Core Data to manage storage
itself - and it makes it possible to access the storage behid the
framework's back. That would be bad.
The functionality you've discovered is there primarily to help you
port your existing model classes to Core Data; Core Data will infer
attributes and relationships from the class declarations, and generate
entities that will be backed by those classes. Then you can change
your superclasses to NSManagedObject, remove your ivars, adjust or
eliminate your accessors, and have converted an existing app to use
Core Data for its object graph management.
-- Chris
On Nov 8, 2008, at 5:53 PM, Jerry Krinock <email@hidden> wrote:
One of the pillars of my understanding of Core Data, I thought, was
that, in a managed object, instance variables are not attributes and
attributes are not instance variables.
Well, I just created a new Data Model from scratch in Xcode 3.1, for
the first time. I was rather surprised when it asked me to choose
classes to put in the model. I just wanted an empty model. Out of
curiosity, I chose a class which was not an NSManagedObject
subclass, but one that I was thinking of "converting" to be an
NSManagedObject subclass. To my surprise, however, the model it
created included an entity of my selected class, and five of its six
instance variables are now its attributes.
Surely this will not work. Is the assumption that indeed I did
intend to "convert" this to an NSManagedObject, and that I would be
manually deleting the instance variables?
Jerry
_______________________________________________
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
_______________________________________________
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