Re: CoreData : fundamental (or not) questions
Re: CoreData : fundamental (or not) questions
- Subject: Re: CoreData : fundamental (or not) questions
- From: "Marcus S. Zarra" <email@hidden>
- Date: Sun, 19 Mar 2006 10:48:20 -0700
On Mar 19, 2006, at 10:39 AM, WhiteContainer wrote:
1- Ok, that confirms my opinion. Maybe in a sheet or in another
window (where user can edit and create mo) should we use another moc ?
Others may correct me but one MOC per NSPersistentStore per thread is
a good rule. I would not use a different MOC for another window just
another thread.
2- Yes, I meant subclass of mo.
For sure, but if you want to access the moc in a + classMethod (of
i.e Department.m), [self managedObjectContext] does not work,
because "self" (the class) is not a mo.
That's why i used this path which works, but it seems to me it is
not so good to use it, maybe a source of conflicts when many docs
are opened :
+ myClassMethod {
....
...[[[NSDocumentController sharedDocumentController]
currentDocument] managedObjectContext]]...;
....
}
Perhaps you should pass in the MOC. But based on your previous code
samples, the two objects you pass into this class method are also MOs
and therefore have a reference to the appropriate MOC. Personally in
this situation I would pass in a reference to the MOC because
according to the documentation you do not have a guarantee that
[NSManagedObject managedObjectContext] will return a reference.
3- Ok for the MVC, but if you want to access to the selectedObject
of a controller inside the code of your Department.m ? Maybe all
the communications with controllers should be managed by MyDocument
and then results of these "questions to the controller" should be
retrieved from MyDocument by Department.m ? In that case, how can I
access a result of a method in MyDocument from Department.m ? Using
@import (I think it will work only for class method, won't it ?) ?
PS - As you can see my problem is mainly communications-based...:-)...
I understand standard MVC-outlets-actions, I understand
controllers&bindings, I understand CoreData structure, but it is
another story to find the good way to make all of these things
playing together, especially if you need to go a little bit out of
the main working !
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden