Re: EOF and the Observer Pattern
Re: EOF and the Observer Pattern
- Subject: Re: EOF and the Observer Pattern
- From: Chuck Hill <email@hidden>
- Date: Thu, 30 Oct 2008 21:04:27 -0700
On Oct 30, 2008, at 6:14 PM, Ken Anderson wrote:
Since it's not likely that all objects that you need to update are
in the EC, I wouldn't depend on any observer paradigms.
When I have dependency situations like that, I usually update them
in my 'finalize' set of methods. My base EO has 3 methods:
finalizeForInsert
finalizeForUpdate
finalizeForDelete
My editing context subclass iterates all EOs to be saved and sends
the appropriate methods. Since I'm OK with the idea of modifying
data in these methods and/or adding new objects, I keep track of all
the objects that have already been sent finalize and loop until all
objects have had the method called. I'm pretty sure Chuck and Sacha
has a similar structure in their book.
Yes, we do. ERXEC also has a similar structure. I am not sure why I
did not think of this before, but it might be what Dave needs, unless
this needs to be updated prior to save.
Chuck
Anyway, I override these methods in subclasses that need to know
when something changed, and do "the right thing". If the objects
that you need to update aren't in memory, you load/fault them. The
nice thing with this methodology is, everything gets saved in the
same commit, so either everything makes it, or nothing does.
Ken
On Oct 30, 2008, at 3:04 PM, Andrew Lindesay wrote:
Hello David;
I use the 'ObjectsChangedInEditingContextNotification' in sub-
entities to update the modifiedTimestamp in major-entities. This
works really well for me.
cheers.
I have several places in my application where a large number of
EOs exist in the DB that are directly dependent upon other EOs. If
the depended-upon EOs change, then all the dependent EOs may need
to be updated.
___
Andrew Lindesay
www.lindesay.co.nz
_______________________________________________
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
_______________________________________________
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
--
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