| The only place where there are MAYBE some pitfalls (and this is just theoretical because I haven't done much testing of this case) is passing EO's between threads. I instead pass GID's, or use ERXEOControlUtilities.convertGIDtoEO/convertEOtoGID if I have dictionaries or arrays of them.
ms On May 31, 2007, at 10:00 AM, Steven Mark McCraw wrote: Hey Ted,
That's how I've been doing it for a bit now, and so far, so good! It certainly doesn't HURT to lock and unlock editing contexts created through ERXEC, but the authors of that whole business have done a great job in making it just as easy to use (locking-wise) as the default editing context, so there doesn't appear to be a need to. If you're already tightly integrated with Project Wonder, it shouldn't be too hard to make the changeover (just kind of tedious as you go through and find all the places that you need to retrieve local instances for relationships). Good luck!
Mark
On May 31, 2007, at 3:15 AM, Ted Archibald wrote:
So, if I use ERXEC is there anything else I have to concern myself about? Is all the locking taken care of that I need to worry about?
IOW, I can just go into my code and any instances I have of a defaultEC for creating and inserting objects I can simply use ERXEC keeping in mind that I need to retrieve local instances of other objects if need be.
On 5/30/07, Steven Mark McCraw <email@hidden> wrote: Hi Ted,
...
So, at the page level, I create a peer ec:
EOEditingContext _peerEC = ERXEC.newEditingContext();
and then use it to create the new objects:
MyEO eo = (MyEO)EOUtilities.createAndInsertInstance(_peerEC, "MyEO");
There are plenty of gotchas to be aware of here, mainly that if you are relating your newly created objects to objects that are contained in another editing context, you have to first bring those other options into the peer:
OtherEO oeo = (OtherEO)EOUtilities.localInstanceOfObject(_peerEC, oeo);
(or use EOUtilities.localInstancesOfObjects(EOEditingContext, NSArray to do a whole set at once).
Hope this helps. Getting past these issues was a bitter struggle for me, and I wasn't even aware of all of the various problems (like having to have an EO in and editing context before doing ANYTHING to it) for several years. Trust me, better to start off following the rules people have figured out from experience than to have to go back later and refactor tons of code to fit those rules.
Mark
_______________________________________________ Do not post admin requests to the list. They will be ignored. Help/Unsubscribe/Update your Subscription:
_______________________________________________ Do not post admin requests to the list. They will be ignored. Help/Unsubscribe/Update your Subscription:
|