Core Data中的对象关系图
2016-11-08 14:16:49 0 举报
Core Data是一个强大的框架,用于在iOS和macOS应用程序中管理对象关系图(ORM)。对象关系图是一种图形表示,用于描述数据模型中实体之间的关系。在Core Data中,实体是具有属性和关系的对象的集合,而数据模型则是定义这些实体、属性和关系的结构。通过使用Core Data,开发人员可以轻松地创建和管理复杂的数据模型,而无需编写大量的代码。此外,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 条评论
下一页