Design pattern to sync objects
- From: "Bryan" <bryanvick@xxxxxxxxx>
- Date: 27 Mar 2007 18:26:59 -0700
I'm looking for a design pattern that will keep two in-memory objects
that are based on the same data in a DB in-sync with each other during
DB updates. I have a full featured 'Person' object with the typical
fields and methods, and a light weight 'smallPerson' object that only
contains ID, FirstName and LastName fields. I use the smallPerson
object for listboxes and such where I don't need to pull all the
person's info from the DB. I use the full featured Person object when
the user wants to edit all of a person's info.
Lets say I have a listbox showing a bunch of smallPerson objects and
the user clicks on one of the items to edit the person. A form pops
up which is bound to the full featured Person object. The user edits
this Person object's first name and then saves it to the DB. Now the
Person object is in sync with the DB, but the smallPerson object is
not. It will still show the old first name until I make another round
trip to the DB to refresh the objects data.
Any patterns to keep two objects based on the same data in sync?
.
- Follow-Ups:
- Re: Design pattern to sync objects
- From: H. S. Lahman
- Re: Design pattern to sync objects
- From: Kai Schwebke
- Re: Design pattern to sync objects
- From: Thomas Gagne
- Re: Design pattern to sync objects
- Prev by Date: Re: Long Life Objects
- Next by Date: Re: Design pattern to sync objects
- Previous by thread: Web based sequence diagram generator
- Next by thread: Re: Design pattern to sync objects
- Index(es):