Core Data中的对象关系图
2016-06-14 14:01:51 0 举报
Core Data是一个强大的数据管理框架,它提供了一种方式来存储和管理应用程序的数据。在Core Data中,对象关系图是一种可视化工具,用于表示实体之间的关系。这些关系可以是一对一、一对多或多对多的。例如,一个博客文章可以有一个作者,而一个作者可以有多篇文章。在这种情况下,我们可以使用Core Data来创建两个实体:BlogPost和Author,并使用对象关系图来表示它们之间的关系。此外,Core Data还支持继承和复合键等高级功能,使得数据模型更加灵活和强大。总之,Core Data中的对象关系图是一个非常有用的工具,可以帮助开发人员更好地理解和管理应用程序的数据。
作者其他创作
大纲/内容
nameNSString
mom = managedObjectModelmoc = managedObjectContextmo = managedObjectps = persistentStorepsc = persistentStoreCoordinatorQ1: How to get mom from moc:moc---momA1: mom = moc.psc.momQ2: mom--entityA2: [mom.entities objectForKey:entityName]因此在NSEntityDescription中就有一个集合了A1 A2功能的函数:moc-entityentityForName: inManagedObjectContext:Q3:How to create a new mo in certain moc with specified entity:[[NSManagedObject alloc] initWithEntity:insertInToManagedObjectContext:] 同样的,NSEntityDescription中从entityName 到 mo的便利函数是:insertNewObjectForEntityForName:inManagedObjectContext:
cacheNodeSetNSSet
objectIDNSManangedObjectID
objectIDNSManagedObjectID
等价
managedObjectNSManagedObject
managedObjectContextNSManagedObjectContext
value
NSAtomicStoreCacheNode
attributeNSAttributeDescription
URIRepresentationNSURL
父类:NSPersistentStore
存储
辅助存储系统
relationship关系
configurationsNSArray
[managedObject valueForKey: key]
configurationNameNSString
父类:NSPropertyDescription
fetchRequestTemplateForName:NSFetchRequest
entity.properties
cacheNodesNSAtomicStoreCacheNode
properties=[attributesByName allKeys] + [relationshipsByName allKeys]NSArray
allValues
entitiesByNameNSDictionary (value:NSEntityDescription)
atomicStoreNSAtomicStore
persistentStoresNSArray
NSManagedObject
cacheNodeNSAtomicStoreCacheNode
NSAtomicStore
propertyCacheNSMutableDictionary
Two layers inside Core Data
User Code
destinationEntityNSEntityDescription
urlNSURL
propertiesByNameNSDictionary
attributesByNameNSDictionary
relationshipsByNameNSDictionary
entitiesNSArray (NSEntityDescription)
metadataNSDictionary
attributeNameNSString
registeredStoreTypesNSDictionary
persistentStoreCoordinatorNSPersistentStoreCoordinator
managedObjectModelNSManangedObjectModel
NSAtomicStore层对象关系图
key
NSManagedObjectContext
relationshipNameNSString
inverseRelationshipNSRelationshipDescription
objectAtIndex:
attribute属性
persistentStoreNSPersistentStore
managedObjectClassNameNSString
entityNSEntityDescrption
attributeTypeNSAttribute
undoManangerNSUndoManager
relationshipNSRelationshipDescription
0 条评论
下一页