Re: Core Data: During Migration, should use Primitive Accessors only?
Re: Core Data: During Migration, should use Primitive Accessors only?
- Subject: Re: Core Data: During Migration, should use Primitive Accessors only?
- From: Adam Swift <email@hidden>
- Date: Tue, 16 Nov 2010 14:42:40 -0800
On Nov 16, 2010, at 10:46 AM, Jerry Krinock wrote:
>
> On 2010 Nov 16, at 09:48, Adam Swift wrote:
>
>> That the objects will be fetched as NSManagedObjects is documented in the versioning & migration guide … Three-Stage Migration.
>
> Thank you, Adam. I see that it says "the class of all entities is changed to NSManagedObject". However, I think that I'm probably not alone in wondering exactly what it means to ** change the class of an entity ** , and the programming implications of it, which I learned when exceptions were raised.
>
It simply means that any class name specified in the managed object model for your entities will be ignored. If the docs don't communicate that clearly then that would be worth filing a bug to clarify the language (it seems clear to me, but I already know how it works).
>> You should be able to use the standard KVC accessors during migration, NSManagedObjects will respond to the foo/setFoo: accessors for properties defined in your managed object model -
>
> Yes, unless, as I found, accessors have been overridden, and the overrides invoke methods which are not defined in NSManagedObject.
>
The accessors defined on your NSManagedObject subclasses will not be called - unless you've added property accessors to NSManagedObject via a category (and you REALLY don't want to do that) that call them directly.
>> the accessors will perform better than valueForKey/setValue:forKey: (see Dynamically-Generated Accessor Methods)
>
> Well, since migration only happens once in a lifetime of a database, I'm not too worried about it, unless it falls to zero, which is what happens when a "method does not respond to selector" exception is raised :(
>
What you seem to be describing shouldn't be possible (unless you've added property accessors to NSManagedObject via a category) - the accessors defined on your subclass are not going to be called during migration because the instances being migrated are not instances of your class.
- adam
_______________________________________________
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