Checking IsDirty at the property level in a business rule

Checking IsDirty at the property level in a business rule

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


RedmondScorpio posted on Tuesday, May 06, 2008

Hello,

I would like to be able to get property metadata like IsDirty in a business rule to validate someone has changed it prior to running the rule logic.  I am using CSLA 3.5.  

At one point I was using

Csla.Core.FieldManager.IFieldData dataPointValue = target.FieldManager.GetFieldData(DataPointValueProperty);

if (dataPointValueIsDirty)

...

But that seems to have been removed in the latest version of 3.5.   Is this something the business rule already knows and doesn't fire if the property hasn't been changed?

A scenario would be someone unchecks a checkbox in the UI, the business rule checks to see if you can set that property to false based on business logic related to other fields in the DB.

Thanks!

Mike

RockfordLhotka replied on Wednesday, May 07, 2008

This is a known problem and is on the wish list.

Exposing the FieldData object like I did in the beta was a problem because it allowed outside code to change the FieldData object's values - and that would have been a mess.

But in restricting access to the object I missed the fact that the IsDirty value needs to be available Sad [:(]

Once I get done with my current bit of non-stop travel I'll address this, probably in a 3.5.2 version.

Copyright (c) Marimer LLC