Quantcast
Channel: CSLA .NET
Viewing all articles
Browse latest Browse all 764

Why FieldData.Value always set IsDirty = true even when value is the same as the old one?

$
0
0

Wouldn't be better if the Value property in FieldData only set the IsDirty flag to 'true' when the new value was different  from the old value?

Cause the class uses generics, I've made the change as below:

        public virtual T Value

        {

            get

            {

                return _data;

            }

            set

            {

                if (_data == null && value == null)

                    return;

                if ((_data != null && !_data.Equals(value)) || 

                    (value != null && !value.Equals(_data)))

                {

                    _data = value;

                    _isDirty = true;

                }

            }

        }


Viewing all articles
Browse latest Browse all 764

Trending Articles