Core Data – I
• History• Fundamentals• Under the Hood• Demo
Enterprise ObjectFramework
History -wiki• Early 1990, NeXT created an Abstraction abovedatabases (DBKit-92)• DBKit failed, in 94 a complete rewrite c...
EOF -wiki• Database tables are mapped to classes.• Database columns are mapped to classattributes.• Database rows are mapp...
Fundamentals
What is Core Data –Apple Doc.• Core Data is a schema-driven object graphmanagement and persistence framework.Fundamentally...
What is Core Data –Apple Doc.• Provides an infrastructure for managing all thechanges to your model objects. This gives yo...
What is Core Data –Apple Doc.• Allows you to keep just a subset of your modelobjects in memory at any given time. This ise...
What is Core Data –Apple Doc.• Uses a schema to describe the model objects.You define the principal features of your model...
What is Core Data –Apple Doc.• Has an infrastructure for data store versioningand migration. This lets you easily upgrade ...
Core Data ComponentsUserManaged Object Context(managed object) (managedobject)Persistent StoreCoordinatorStorage Storage S...
InitializationDataModel(.momd)Persistent Sore(sqlite/xml...)ManagedObjectContext
In ActionUserCodeNSFetchRequestMOMOCPersistent SoreCoordinatorn1Persistent Sore momd
Under the Hood• Core Data applications requires an ObjectModel (NSManagedObjectModel)– Model defines entities (NSEntityDes...
Demo
Upcoming SlideShare
Loading in …5
×

Pune-Cocoa: Core data - I

478 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
478
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Legacy databases can be easily wrapped in EOF
  • Legacy databases can be easily wrapped in EOF
  • NSManagedObjectModel has references to zero or more NSEntityDescription objects. Each NSEntityDescription has references to zero or more NSPropertyDescription objects. NSPropertyDescription is an abstract class with three concrete implementations This small set of classes is enough to define any object model you will use when working on your Core Data projects.
  • Pune-Cocoa: Core data - I

    1. 1. Core Data – I
    2. 2. • History• Fundamentals• Under the Hood• Demo
    3. 3. Enterprise ObjectFramework
    4. 4. History -wiki• Early 1990, NeXT created an Abstraction abovedatabases (DBKit-92)• DBKit failed, in 94 a complete rewrite came asform of EOF (4 people team!) – read only• EOF2.0 in 95 – Context Editing• EOF was useful for WWW and web apps• In 96 first OO webserver WebObjects launchedwith EOF at its heart• 2005, EOF returns to OSX Tiger as Core Data• June 2009 Released for iPhone OS 3.0
    5. 5. EOF -wiki• Database tables are mapped to classes.• Database columns are mapped to classattributes.• Database rows are mapped to objects (or classinstances)• Can leverage inheritance• EO is a class which models a physical orconceptual object in the business domain.
    6. 6. Fundamentals
    7. 7. What is Core Data –Apple Doc.• Core Data is a schema-driven object graphmanagement and persistence framework.Fundamentally, Core Data helps you to savemodel objects (in the sense of the model-view-controller design pattern) to a file and getthem back again. This is similar to archiving,but Core Data offers much more than that.
    8. 8. What is Core Data –Apple Doc.• Provides an infrastructure for managing all thechanges to your model objects. This gives youautomatic support for undo and redo, and formaintaining reciprocal relationships betweenobjects.
    9. 9. What is Core Data –Apple Doc.• Allows you to keep just a subset of your modelobjects in memory at any given time. This isespecially important on iOS where conservingmemory is critical.• Allows you to maintain disjoint sets of edits ofyour objects. This is useful if you want to, forexample, allow the user to make edits in oneview that may be discarded without affectingdata displayed in another view.
    10. 10. What is Core Data –Apple Doc.• Uses a schema to describe the model objects.You define the principal features of your modelclasses—including the relationships betweenthem—in a GUI-based editor. This provides awealth of basic functionality “for free,”including setting of default values and attributevalue validation.
    11. 11. What is Core Data –Apple Doc.• Has an infrastructure for data store versioningand migration. This lets you easily upgrade anold version of the user’s file to the currentversion.
    12. 12. Core Data ComponentsUserManaged Object Context(managed object) (managedobject)Persistent StoreCoordinatorStorage Storage Storage
    13. 13. InitializationDataModel(.momd)Persistent Sore(sqlite/xml...)ManagedObjectContext
    14. 14. In ActionUserCodeNSFetchRequestMOMOCPersistent SoreCoordinatorn1Persistent Sore momd
    15. 15. Under the Hood• Core Data applications requires an ObjectModel (NSManagedObjectModel)– Model defines entities (NSEntityDescription)Entities have three kind of Properties(NSPropertyDescription):• Attributes (NSAttributeDescription)• Relationships (NSRelationshipDescription)• Fetched Properties (NSFetchedPropertyDescription)
    16. 16. Demo

    ×