I have a document-based Core Data application that works as it is. I would like to add global persistent storage support for storing an element library.
I have read most of the relevant documents and understand that I should use configurations in managed object models. I defined two configurations: "DocumentConfiguration" and "LibraryConfiguration". Objects in the document configuration are only in the document configuration, and objects in the library configuration are only in the library configuration, that is, there is no overlap.
Then the docs say, "Then you use this model when creating the coordinator." But I actually do not create my own persistent repository coordinator, since I use the default NSPsistentDocument coordinator.
A few questions about how best to act and help resolve any misconceptions I may have:
and. Did I get the NSPersistentStoreCoordinator in the NSPersistentDocument and then add a new persistent store to it in the lines:
NSPersistentStoreCoordinator * coordinator = [[myDocument managedObjectContext] persistentStoreCoordinator];
[coordinator addPersistentStoreWithType:NSXMLStoreType
configuration:@"LibraryConfiguration"
URL:url
options:nil
error:&error];
, , ( "DocumentConfiguration" ) NSPersistentDocument, , NSPersistentDocument. , , , , . , ? I.e., , , ( )? ( "DocumentConfiguration" ) NSPsistentDocument , /? NSPersistentDocument:
URL- : . : .
. NSPsistentStoreCoordinator NSManagedObjectContext, , NSPsistent.Document NSPersistentStoreCoordinator NSManagedObjectContext ? , URL- NSPersistentDocument addPersistentStoreWithType:...? , URL- . ( , , - ( persistentStores ), ).
. NSPersistentDocument NSPsistentStoreCoordinator, ? , NSPersistentStoreCoordinator Core Data, Core Data. NSPsistentStoreCoordinator - ( , , , )?
?