HI
I am just starting to learn Core Data and one part that confuses me is the inverse relationship. Lets say that I have a entitiy named Photo and one enitity named Photograph, just as in the Stanford course. A photograph has a one to many relationship to photo, and one photo belongs to one photograph.
My question is (I know SQL) is what are the inverse relationships I have to make? This probably has to do with primary/foreign key however I do n开发者_C百科ot understand what inverse relationship does?
Thanks for your time:=)
An inverse relationship maintains data integrity when changes are made to instances of an entity:
You should typically model relationships in both directions, and specify the inverse relationships appropriately. Core Data uses this information to ensure the consistency of the object graph if a change is made (see “Manipulating Relationships and Object Graph Integrity”). For a discussion of some of the reasons why you might want to not model a relationship in both directions, and some of the problems that might arise if you don’t, see “Unidirectional Relationships.”
精彩评论