FieldData always mark object as dirty

FieldData always mark object as dirty

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


Codelines posted on Friday, June 06, 2014

When I call CancelEdit in an object, the UndoChanges method set the FieldData.Value property and that property always set isDirty to true. If I check the IsDirty property before close the edition form to warn the user about changes not saved, I always get IsDirty = true. So I changed the FieldData.Value property to this:

        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;

                }

            }

        }

Are there any problem in changing that property the way I've done?

Copyright (c) Marimer LLC