On Jul 19, 2014, at 12:37 , Jerry Krinock <je...@ieee.org> wrote:

> 
> On 2014 Jul 18, at 15:54, Rick Mann <rm...@latencyzero.com> wrote:
> 
>> Is it wrong to create relationships in 
>> -createDestinationInstancesForSourceInstance:…?
> 
> Yes, it is wrong, according “Three Stage Migration” of the Core Data Model 
> Versioning and Data Migration Programming Guide…
> 
> https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmMigrationProcess.html#//apple_ref/doc/uid/TP40004399-CH6-SW8

Huh. Sure enough, it says, "In this stage, only attributes (not relationships) 
are set in the destination objects." However, I had decided that there was no 
good reason not to set a relationship between two new destination objects if 
they were both created in one -create… call, and proceeded to do it anyway. 
Worked fine.

Then I discovered that you don't need to do that, if you leverage all the 
automatic capabilities afforded by automatic migration. Simply by calling 
-[super create…], you can get the bulk of the work done by specifying 
expressions in the Mapping Model editor, and it's got a much more compact (if 
somewhat unwieldy) way of specifying the new relationships. Once I realized 
that, my actual code got a lot smaller and tidier.

-- 
Rick Mann
rm...@latencyzero.com



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to