mirror of
https://github.com/zhigang1992/MagicalRecord.git
synced 2026-01-12 17:32:18 +08:00
Use mogenerator insert method if present
This commit is contained in:
@@ -575,8 +575,16 @@ static NSNumber *defaultBatchSize = nil;
|
||||
|
||||
+ (id) createInContext:(NSManagedObjectContext *)context
|
||||
{
|
||||
NSString *entityName = NSStringFromClass([self class]);
|
||||
return [NSEntityDescription insertNewObjectForEntityForName:entityName inManagedObjectContext:context];
|
||||
if ([self respondsToSelector:@selector(insertInManagedObjectContext:)])
|
||||
{
|
||||
id entity = [self performSelector:@selector(insertInManagedObjectContext:) withObject:context];
|
||||
return entity;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *entityName = NSStringFromClass([self class]);
|
||||
return [NSEntityDescription insertNewObjectForEntityForName:entityName inManagedObjectContext:context];
|
||||
}
|
||||
}
|
||||
|
||||
+ (id)createEntity
|
||||
|
||||
Reference in New Issue
Block a user