I am developing an application to manage entrants in a marathon as a means to teach myself objective-C and cocoa.
The application uses core data for data storage.
I want to have a single window that handles the competitor detail data entry and edit. I originally modeled the design on the Departments and Employees example from the Apple Developer website, where a sheet opens with its own managed object context, and when the user finishes data entry, the details are copied from the sheet managed object context to the document managed object context. I have a running application that can edit data, but not add it (this may sound back to front, but I have already implemented the importation of competitor data from the online registration system)
My problem is that whereas the Department and Employees example was dealing with a single managed object in the sheet, my application has to deal with a number of managed objects and relationships (what events they have entered, what merchandise they have bought, what payments etc they have made). Whereas the Apple example simply copies information for one managed object from one context to another (which is a achieved in 4 lines of simple code), I have to recreate all the managed objects and then recreate all the relationships as well.
I am now wondering why not do this all on the main managed object context.
Is there a right/wrong way of doing this - am I better sticking to the separate contexts, or is it simpler to do it all on the main context?
The application uses core data for data storage.
I want to have a single window that handles the competitor detail data entry and edit. I originally modeled the design on the Departments and Employees example from the Apple Developer website, where a sheet opens with its own managed object context, and when the user finishes data entry, the details are copied from the sheet managed object context to the document managed object context. I have a running application that can edit data, but not add it (this may sound back to front, but I have already implemented the importation of competitor data from the online registration system)
My problem is that whereas the Department and Employees example was dealing with a single managed object in the sheet, my application has to deal with a number of managed objects and relationships (what events they have entered, what merchandise they have bought, what payments etc they have made). Whereas the Apple example simply copies information for one managed object from one context to another (which is a achieved in 4 lines of simple code), I have to recreate all the managed objects and then recreate all the relationships as well.
I am now wondering why not do this all on the main managed object context.
Is there a right/wrong way of doing this - am I better sticking to the separate contexts, or is it simpler to do it all on the main context?