Re: EOEditingContext.isDisposed() ... ?
Re: EOEditingContext.isDisposed() ... ?
- Subject: Re: EOEditingContext.isDisposed() ... ?
- From: Chuck Hill <email@hidden>
- Date: Fri, 3 Sep 2010 19:04:59 -0400
On Sep 3, 2010, at 2:53 PM, Farrukh Ijaz wrote:
> Hi,
>
> Is there a way to check if the editingContext is disposed?
There is, but it is not exposed.
> I guess there should be something called isDisposed(), it is useful for following scenario.
>
> private EOEditingContext _editingContext;
>
> public EOEditingContext editingContext() {
> if(_editingContext == null || _editingContext.isDisposed()) {
> _editingContext = ERXEC.newEditingContext();
> }
> return _editingContext;
> }
>
> This ensures that whenever the call is made to editingContext(), the editing context will be valid.
>
> Just a thought.
I can't think of a good coding practice that would want that code. dispose() is normally called by finalization. If you dispose of your ECs manually, earlier, you should either null the reference or replace the EC. That would be good coding practice. Keeping a reference to a disposed EC seems... undesirable.
Chuck
--
Chuck Hill Senior Consultant / VP Development
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
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden