Question regarding IsDirty.

Question regarding IsDirty.

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


dhr posted on Monday, April 20, 2009

Hi there, I'm creating a customer order datebase, which requires the use of grand children and great grand children.  Most of the project is working fine, however, my current issue is when I make a change to a great grand child, my root object's IsDirty property stays at false.

My root object (Customer) does have an override for IsDirty and IsValid, which references the child objects that are in the Customer object. I'm wondering if that is enough, or do I have to also include the grand children and great grand children.

Currently my override looks like this

public override bool IsDirty { get { return base.IsDirty || _transactions.IsDirty || _order.IsDirty; } }

The only way I could think to show my issue was to display the output from my ui's save command (was using it to help myself understand what was going on.)

sergeyb replied on Monday, April 20, 2009

You should also overwrite dirty and valid in each transaction and order and have them query their own children lists, etc…

 

If you use managed properties, this behavior is automatic, BTW.  

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: dhr [mailto:cslanet@lhotka.net]
Sent: Monday, April 20, 2009 11:44 AM
To: Sergey Barskiy
Subject: [CSLA .NET] Question regarding IsDirty.

 

Hi there, I'm creating a customer order datebase, which requires the use of grand children and great grand children.  Most of the project is working fine, however, my current issue is when I make a change to a grate grand child, my root object's IsDirty property stays at false.

My root object (Customer) does have an override for IsDirty and IsValid, which references the child objects that are in the Customer object. I'm wondering if that is enough, or do I have to also include the grand children and grate grand children.

Currently my override looks like this

public override bool IsDirty { get { return base.IsDirty || _transactions.IsDirty || _order.IsDirty; } }

The only way I could think to show my issue was to display the output from my ui's save command (was using it to help myself understand what was going on.)



dhr replied on Monday, April 20, 2009

Thanks for the quick reply..   I had always thought that I needed to override IsDirty in my child objects.. 

I added those extra overrides to any child object that also was a parent of another child object, and now everything is working nicely.   Many Thanks

sergeyb replied on Monday, April 20, 2009

Indeed, unless you switch to managed properties.

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: dhr [mailto:cslanet@lhotka.net]
Sent: Monday, April 20, 2009 12:05 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: Question regarding IsDirty.

 

Thanks for the quick reply..   I had always thought that I needed to override IsDirty in my child objects..   I guess I need to do this for each object that is a parent for another child?


Copyright (c) Marimer LLC