Questions tagged [mapping-model]

A mapping model is a Core Data construct that helps define how one version of a object model is migrated to another version the object model.

A mapping model is a collection of objects that specifies the transformations that are required to migrate part of a store from one version of your model to another (for example, that one entity is renamed, an attribute is added to another, and a third split into two). You typically create a mapping model in Xcode. Much as the managed object model editor allows you to graphically create the model, the mapping model editor allows you to customize the mappings between the source and destination entities and properties.

from Core Data Model Versioning and Data Migration Programming Guide

67 questions
1
vote
1 answer

Programmatical Creation of NSMappingModel

I want to programmatically (without Lightweight Migration) create a mapping model between two models that are exactly the same, except one of the entities (there are a bunch of entities) has different attributes. Let's call this entity "Person". And…
Enchilada
  • 3,859
  • 1
  • 36
  • 69
1
vote
1 answer

iPhone core data migration date to string

I have an entity that originally started with a date attribute. I have now added a attribute that is a string that I want to hold the date, in addition to keeping the original field. I've made a mapping model, but I'm not sure what to put into…
agilityvision
  • 7,901
  • 2
  • 29
  • 28
1
vote
1 answer

ng-model not working with ngAutocomplete

I am using angularjs in my web application.I have a text box in which locations are selected with autocomplete.This is done with ngAutocomplete.js(Refering this example http://plnkr.co/edit/il2J8qOI2Dr7Ik1KHRm8?p=preview) .I need to load location…
Vishnupriya
  • 111
  • 3
  • 10
0
votes
1 answer

Defining Many-to-Many Association in Entity Framework

I have the following tables in my edmx : Errors Id, Description, solved, officeId, siteId Sites id, location, name , officeId Offices officeId, officeName the mapping between offices to sites are 1-to-many(offices can have many instances of…
RonenIL
  • 273
  • 3
  • 8
  • 17
0
votes
1 answer

Entity Framework - Splitting table to multiple entities WITH AN OVERLAPPING CONDITION

Is there a way to preform the following mappings (using database-first approach): Tables: (Defining tables with C#-like syntax for readability purposes only) table MainItems { column PK not-null unique int MainItemKey; column string Name; …
0
votes
1 answer

add objects with child collections

I have two classes: a Site class and a Phase class. The Site class defines a collection of Phases. Each class corresponds to a database table. The database (SQL Server 2000) has a one to many reference between the two tables such that a given Site…
0
votes
1 answer

How do I set the value of an inverse relationship in a mapping model?

In v1 of my model I have a one to many relationship between a presentation and slides: presentation---->>slides In v2 I fix this foolishness by adding an inverse one to one: presentation<--->>slides In both models a slide belongs to 1 and only 1…
Benedict Cohen
  • 11,912
  • 7
  • 55
  • 67
0
votes
2 answers

Core Data: endless loop while auto-migrating between two data models

I have my old data model, my new model (same but with two more text fields in one entity) and a mapping model (just the default generated one). When I do automatic migration, I get a crash and a stacktrace that looks like it's entered an endless…
niklassaers
  • 8,480
  • 20
  • 99
  • 146
0
votes
1 answer

How to avoid a huge .xcmappingmodel file for small datamodel changes?

I currently have a unique MyProject.xcdatamodeld file. It is fairly easy to do the following, as no additional step is required: add fields/classes But I will need a MyProject.xcmappingmodel if I want to: remove a field/class rename a…
Cœur
  • 37,241
  • 25
  • 195
  • 267
0
votes
1 answer

Core Data Migration: Extracting fields to an abstract entity child

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…
Tim Sullivan
  • 16,808
  • 11
  • 74
  • 120
0
votes
2 answers

CoreData customize mapping model

I have a problem mapping the following situation from v1 to v2 of a core data model. In v1 of the model I had an entity named book with an attribute author. There I saved the first and last name of the author and even first and last names of several…
b00tsy
  • 635
  • 8
  • 25
0
votes
1 answer

iPhoneOS Core Data migration: moving something from an entity into a file

I have a scenario where I'm moving the contents of a blob stored in a core data entity into a file. I need a way to export that data during a migration, where I know the entity that's being converted and save the blob to a file, writing the location…
Tim Sullivan
  • 16,808
  • 11
  • 74
  • 120
0
votes
1 answer

Isn't using lightweight migration with dozens of updates going to kill performance?

One think I notices is, that I must probably keep the whole stack of model versions intact when shipping updates. I am not sure what happens if someone has version 1.0 with populated data, and then instantly updates to version 5.0 without any of the…
dontWatchMyProfile
  • 45,440
  • 50
  • 177
  • 260
0
votes
1 answer

Using Mapping Models to migrate between Core Data Object Models

I have a fairly simply schema. Essentially, Run <--> Data (where a Run holds a data, e.g., Temperature, sampled from some sort of sensor). Now, it seems that sensors can have more than one measurement (e.g., Temperature and Humidity). So, a single…
westsider
  • 4,967
  • 5
  • 36
  • 51
0
votes
1 answer

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

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 =…
Jaanus
  • 17,688
  • 15
  • 65
  • 110