Core Data terms

March 11th, 2011
#core data #persistence

I'm often asked to explain Core Data to the new joiners. I thought I'd share what I tell them about the components that make up Core Data:

  1. Persistent store - is where Core Data stores its data, more often in a form of a SQLLite database but can be Atomic (binary store) or In-Memory.
  2. NSPersistentStoreCoordinator - controls access to the persistent store - save, retrieve and search.
  3. NSManagedObjectModel - representation of data model in memory, can combine multiple persistent stores into one. Represented by .xcdatamodel files
  4. NSManaagedObjectContext - a scratch pad that contains all NSManagedObjects that have been created or loaded, handles changes to these objects and handles committing these change to the persistent store when you tell it to. This allows to for undo functionality to be added to your application.
  5. Entities - data model class, like a normal Objective-C class declaration.
  6. NSManagedObject - data object that represents a row in an entity.
  7. Attributes - can be thought of instance variables of a normal Objective-C class.
  8. Relationships - association between two different entities, can be as a "to one" or "to many" relationship.
  9. Fetched properties - can be thought of as a weak relationship between NSManagedObjects in an entity.
  10. Fetch Requests - can be thought of as a query against the entity

What do you think? Let me know by getting in touch on Twitter - @wibosco