mapping-model

Core Data Migration - Can't find mapping model for migration

六眼飞鱼酱① 提交于 2019-12-30 03:12:10
问题 I followed the guide found here: http://www.timisted.net/blog/archive/core-data-migration/ but keep getting "Can't find mapping model for migration" when I start up the app with the new model. I've tried it in xcode 3 and xcode 4, multiple times, but can never get it to work. Currently my options are set to: NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:NO],

iPhone Core Data Lightweight Migration: Can't merge models

泄露秘密 提交于 2019-12-29 07:12:11
问题 I just started with iPhone core data and I ran into a problem in lightweight migration. I added two new fields to my old model Regenerated the model class files Made the new model version as current version Added the following code in AppDelegate in the template generated NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; if

Core Data Migration: Extracting fields to an abstract entity child

帅比萌擦擦* 提交于 2019-12-25 03:27:02
问题 I have a migration where I'm moving fields from one entity into another entity which is a child of an abstract entity. My model has an entity, Thing , which is 1->M to an abstract entity, AbstractWidget , which is the parent for NewStuff . Something like this: +-------+ +----------------+ +----------+ | Thing |<--->>| AbstractWidget |<---| NewStuff | +-------+ +----------------+ +----------+ I am moving several attributes from Thing to NewStuff , and I've been following the instructions on a

How to map parent column in EF 4.1 code first

若如初见. 提交于 2019-12-23 12:37:16
问题 In my project I have following DomainModel. public class Login { public Guid Id { get; set; } public Login CreatedBy {get; set; } } I am using fluent configuration as below: modelBuilder.Entity<Login>() .HasKey(x => x.Id) .ToTable("Login"); modelBuilder.Entity<Login>() .HasOptional(x => x.CreatedBy) .WithMany() .HasForeignKey(x => x.CreatedBy); My code in repository to get all Logins data is as below: return from d in Db.Logins.Include("CreatedBy") select d; When I execute the code I am

Core Data lightweight migration: Can't find or automatically infer mapping model for migration

只谈情不闲聊 提交于 2019-12-21 12:11:11
问题 So I created a new version of my data model, and made a previously optional field non-optional (giving it a default value). According to the documentation, this should mean my migration is eligible for lightweight, automatic migration. I also added options that allow this when I open the store, also per the documentation: NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES

Core Data Migration: Attribute Mapping Value Expression

≡放荡痞女 提交于 2019-12-20 10:57:34
问题 I currently have a cardType attribute on my entity, which in the old model could be "Math", "Image" or "Text". In the new model, I'll be using just "Math" and "Text" and also have a hasImage attribute, which I want to set to true if the old cardType was Image (which I want to change to "Text"). Lastly, I have a set of another entity, "card", of which a set can be associated with a deck, and in each of those, I'll also have hasImage which I want to set to true if the deck was of "Image" type

Core Data Inferred Migration – Automatic “lightweight” vs Manual

自古美人都是妖i 提交于 2019-12-18 10:56:43
问题 I've updated the model of an existing iPhone app in some simple ways (remove attribute, add attribute, remove index), and can use automatic lightweight migration to migrate the persistent store. Due to the typical size of the data set, the processing time is not insignificant, and warrants feedback for the user. NSMigrationManager provides a simple but useful migrationProgress value that sends KVO notifications as the migration is performed. That forms the basis of providing feedback, however

Core Data Mapping Model version hashes not matching to source model version hashes

亡梦爱人 提交于 2019-12-18 06:59:19
问题 With Core Data Migration Debug enabled, when performing a migration I see three entities (2, 3, 4) with changed hashes, as expected. Entity 1 doesn't change and is for illustration. Store metadata (source model): Entity1 = <67852e01 ...>; Entity2 = <2b68bba5 ...>; Entity3 = <58babd8d ...>; Entity4 = <1c694c80 ...>; Current model (destination model): Entity1 = <67852e01 ...>; Entity2 = <260e4d68 ...>; Entity3 = <13360b6f ...>; Entity4 = <16513e1b ...>; Next, I create the mapping model, but the

I keep on getting “save operation failure” after any change on my XCode Data Model

◇◆丶佛笑我妖孽 提交于 2019-12-17 17:31:30
问题 I started using Core Data for iPhone development. I started out by creating a very simple entity (called Evaluation) with just one string property (called evaluationTopic). I had following code for inserting a fresh string: - (void)insertNewObject { // Create a new instance of the entity managed by the fetched results controller. NSManagedObjectContext *context = [fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[fetchedResultsController fetchRequest] entity];

How to switch from Core Data automatic lightweight migration to manual?

送分小仙女□ 提交于 2019-12-08 12:46:37
问题 My situation is similar to this question. I am using lightweight migration with the following code, fairly vanilla from Apple docs and other SO threads. It runs upon app startup when initializing the Core Data stack. NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; NSError *error = nil; NSString *storeType = nil; if (USE