Created
October 24, 2012 06:50
-
-
Save gonzalezreal/3944444 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| + (NSString *)entityName | |
| { | |
| return NSStringFromClass([self class]); | |
| } | |
| + (NSFetchRequest *)fetchRequest | |
| { | |
| NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:[self entityName]]; | |
| [fetchRequest setFetchBatchSize:25]; | |
| return fetchRequest; | |
| } | |
| + (id)insertNewObjectInManagedObjectContext:(NSManagedObjectContext *)context | |
| { | |
| return [NSEntityDescription insertNewObjectForEntityForName:[self entityName] | |
| inManagedObjectContext:context]; | |
| } | |
| + (id)importFromDictionary:(NSDictionary *)dictionary inManagedObjectContext:(NSManagedObjectContext *)context | |
| { | |
| TGRManagedObject *object = [self insertNewObjectInManagedObjectContext:context]; | |
| [object importValuesFromDictionary:dictionary]; | |
| return object; | |
| } | |
| - (void)importValuesFromDictionary:(NSDictionary *)dictionary | |
| { | |
| // Must be overridden by subclasses | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment