Re: Practical EditingContext Design Question
Chuck Hill <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, On Feb 16, 2006, at 7:32 AM, Arturo Perez wrote: > [email protected] wrote: >> >> Is it a good solution ? >> In the book, different king of EditingContext are explained but >> wich one do we need to use for the readers ? >> DefaultShareEditingContext ? Other ? >> >> Many thank's for any advice, >> >> Jérémy > That's what the DefaultSharedEditingContext is for (many readers, > few writers) No. While the EOSharedEditingContext is, technically, instanceof EOEditingContext it is _not_ a proper editing context and should not be used as one. You will run into trouble doing that. It is a shared, read-mostly, object store. Someone at Apple got a little lazy and did implementation inheritance instead of holding a reference to an EC or something similar. > but most people have trouble implementing it properly. That may or > may not be because it's buggy. > I'm told ;-) that as of 5.2.4 it is no longer buggy _provided_ that you use it appropriately (e.g. not as an editing context). I've not verified this. > What you can do instead is have an application-level editing > context and set your session's defaultEditingContext to that. Then > when a writer comes > in you don't set it. > I wouldn't want to do that... > Of course, you'll have to make sure that you do multithreading and > locking properly in either case. > Locking the shared EC on your own (or having session lock it as the default editing context) is a risky proposition. Risking deadlock, IIRC. Chuck -- Coming in 2006 - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects