ios - Model a tree structure in Core Data -


i want implement multi-way tree using core data. there's "plan" entity in core data model.

            plan            /  |  \         plan plan plan      /  | \   |     |   \    plan plan ... 

the plan of higher level have to-many relationship sub-plans.

so how should set relationship?

enter image description here

enter image description here

i define

  • a to-many relationship subplans (or children) plan entity itself, "delete rule" set "cascade",
  • a to-one relationship superplan (or parent) plan entity itself, "delete rule" set "nullify",
  • and set these inverse relationships of each other.

if delete 1 plan object, automatically

  • all sub-plans deleted due "cascade" delete rule, and
  • the plan removed parent object due "nullify" delete rule.

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -