iphone - Data modeling in CoreData, (folders and documents with many children, etc) -
I have used the codead in some time but data modeling is very easy. This time I should implement the following:
- Users can create documents and folders (they do not have to be real folders / directories).
- Documents or other folders in the folder
- Documents are:
- 1 title,
- 1 description and
- 8
- Each child may also have a title and a description and it can have 8 children (optionally)
- Levels (recursive) may be as if the user desires
I'm not sure how to express it in CoreData. Can someone give a hand here? Right now I think about:
"title" with title "title" and "child" as a specialty (as many as one). "Aizenfolder" with a "file" unit as a boolean feature and "document" as a relationship (many from one, pointing to "hair")
I'm not sure It applies well above the structure in the coredata. Am i on the right track Re-modeling data structure in Coradata can be painful (I have heard) I would like a good structure from the beginning; I hope you can get some advice;)
Thanks in advance.
You probably want something like this (pseudocode):
Folder {Parents & lt; & Lt; - (required, wipe) - & gt; Folder. Folder folders & lt; - (Optional, Cascade) - & gt; Folder. Original document & lt; - (Optional, Cascade) - & gt; & Gt; Document. Folder} document {title: string description text: string parent & lt; & Lt; - (Optional, cancellation) - & gt; Document; Children's children & lt; - (Optional, Cascade) - & gt; & Gt; Document. Parent folder & lt; & Lt; - (Optional, empty) - & gt; Folder.document}
(Warning term: Do not use "description" as an attribute name. NSObject has a description
method, Therefore, every subclass of NSObject responds to the details
message, it will be the cause of all kinds of ugly problems if you have the attribute accessor of the same name.)
Comments
Post a Comment