DataObject boilerplate

This forum is for programmers who have questions about the source code.
Post Reply
User avatar
jordansparks
Site Admin
Posts: 5776
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

DataObject boilerplate

Post by jordansparks »

OK, I just used the new DataObject framework for the last 6 or so tables that I added. It's working very well. I did run into one issue that I think needs to be addressed. I think a field like this:

Code: Select all

 [DataField("Descript")]
		private string descript;
		bool descriptChanged;
		/// <summary>The description can be similar to the catalog, but not required.  Typically includes qty per box/case, etc.</summary>
		public string Descript {
			get { return descript; }
			set { descript = value; MarkDirty(); descriptChanged = true; }
		}
		public bool DescriptChanged {
			get { return descriptChanged; }
		} 
needs to be changed to look like this:

Code: Select all

 [DataField("Descript")]
		private string descript;
		bool descriptChanged;
		/// <summary>The description can be similar to the catalog, but not required.  Typically includes qty per box/case, etc.</summary>
		public string Descript {
			get { return descript; }
			set { if(descript!=value){descript = value; MarkDirty(); descriptChanged = true; }}
		}
		public bool DescriptChanged {
			get { return descriptChanged; }
		} 
I was making use of the various Changed properties, and found that they were always returning true when they should not have. But my main concern is that if they are always true, then there will be more risk of concurrency issues in the patient, appointment, and procedure tables. In other words, more data is being sent to the database than is minimally necessary.

I made the change to the DataObject where I needed it. It's my intention to make the same change to all the tables I've recently added.
Jordan Sparks, DMD
http://www.opendental.com
fcarlier
Posts: 75
Joined: Tue Jun 19, 2007 3:12 am
Location: Ghent, Belgium

Post by fcarlier »

That is correct.
Frederik Carlier
Post Reply