child.isDirty

child.isDirty

Old forum URL: forums.lhotka.net/forums/t/3426.aspx


culprit posted on Saturday, August 25, 2007

Okay, I know it must be something simple I am doing wrong. I have several dozen classes now and child lists are working good informing the parent thru the overriden IsDirty/IsValid properties, ie-

Public Overrides ReadOnly Property IsValid() As Boolean

Get

Return MyBase.IsValid AndAlso _claimFields.IsValid

End Get

End Property

Public Overrides ReadOnly Property IsDirty() As Boolean

Get

Return MyBase.IsDirty OrElse _claimFields.IsDirty

End Get

End Property

But  I have this new class with a child list _claimFields and when I only make a change to the child list the Data_Update is not fired, but if i make a change to parent data the Update is fired and if I check the dirty state of the child in the update event it is dirty. I dont think i am doing anything different except that this child is not drawn from the DB but I am creating the child objects by parsing a string in the parent class.

Thanks in advance,

Rob

 

culprit replied on Tuesday, August 28, 2007

I am still struggling and am baffled why the dirty child ListBase is not causing the parent Data_Update routine to fire. As I mentioned when I force the Data_Update routine to run by changing something in the parent the child listbase is definitely flagged as dirty.

Thank You,

Rob

 

richardb replied on Friday, August 31, 2007

It may be dirty but might it also be NOT Valid thus NOT firing the Update (Either the Parent or the Child or another child in the collection / list?

Are you binding to a Windows forms control?  You could try writing some test code just setting the properties on the object and seeing what's valid/invalid dirty/not dirty without doing any binding.

In the past I've had some "funnies" where I ended up touching the child collection to force it to be dirty so the code would then go through the children checking those, but that's CSLA1.x days, and probably demonstrates that I couldn't solve the problem correctly. 

Hope my limited response helps a bit. 

dean replied on Friday, September 14, 2007

Just checking - have you tried overriding the save function in your parent object and checking the state of the listbase to make sure it is dirty (using a breakpoint or debug.write statement)?

Dean

Copyright (c) Marimer LLC