BusinessRules.CheckRules() -> does it set IsDirty?

BusinessRules.CheckRules() -> does it set IsDirty?

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


Ranjini posted on Wednesday, October 13, 2010

I know this subject has possibly been discussed several times on this forum, but I am confused as to what it is really meant to do. So, i thought I will throw the question out there and see if i can get some clarity.

Per , http://forums.lhotka.net/forums/p/9279/44060.aspx#44060 (a post from July of this year), it seems like CheckRules doesnt set IsDirty = true if it changes the value of a property, but I am experiencing otherwise.

I have a BB (root with other properties) -> BLB -> BB situation. I added a rule to the BB root where i am doing some computation and altering a property of the BB (child) that belongs to the BLB. After the rule executes , the BB (child) is marked as IsSelfDirty and the whole object graph is hence marked IsDirty. Is this how it is meant to work? If it is , is there a way to get around this? I need a clean object coming back from the server and I am unable to find a way to get around this.

Please clarify.....

Thanks

Marjon1 replied on Wednesday, October 13, 2010

As per the previous post, if you are using the direct properties on the BB (child) object then the field would be marked as dirty when the value changed, if you don't want the object to be marked as dirty, doing one of the following should work. 

 

 

Seeing a sample of the code within your business rule would also make this much easier to identify what is causing your problem, but essentially CheckRules is no different to any other code. If you change a property in a way that would normally result in it being marked as dirty, then it will be marked as dirty within this method as well. 

Ranjini replied on Monday, October 18, 2010

THanks much...

I changed SetProperty to LoadProperty on the BB Child's property i am altering and all is good !! thanks again!

Copyright (c) Marimer LLC