I have categories on my entities that allow me to parse JSON into an entity:
- (id) populateFromJson: (NSDictionary *) json {
...
}
So then using MagicalRecord I can do this:
MyEntity *e = [My MR_createInContext:localContext];
[e populateFromJson:json];
However after I parse that into an entity I need to check if it already exists in the main context, ie check for duplicates. If it already exists in the main context I do not want to insert it into the context, however I cannot find a way using MagicalRecord to create an entity as part of a context, but don't insert into that context.
ie in core data you can do this:
MyEntity *e = [[MyEntity alloc] initWithEntity:[NSEntityDescription entityForName:@"MyEntity" inManagedObjectContext:[NSManagedObjectContext MR_defaultContext]] insertIntoManagedObjectContext:nil];
Where you pass nil to the context to insert into.
Then later if not a duplicate you can:
[localContext insertObject:e];
Am I missing something or is there not a way to do this in MagicalRecord?