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

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

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


Codelines posted on Saturday, August 23, 2014

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;

                }

            }

        }

Copyright (c) Marimer LLC