RejectChanges() Problem

Jul 9, 2007 at 3:45 PM
Hi,
I have a problem when I call the RejectChanges method.
The collection items with Status setted to Deleted are not restored after the method call.

I saw the Storage class RejectChanges implementation. During the program execution the method returned when it check object.Equals(_Clone,default(T)) so the status is never changed to Normal status (istruction: _Status = ObjectStatusType.Normal).

Thanks
Andrea
Coordinator
Jul 9, 2007 at 11:10 PM
I just fixed the problem but please wait for some time. I have to make a regression test before releasing it.
I'll let you know asap in this thread.
Thanks
Coordinator
Jul 18, 2007 at 9:01 AM
Edited Jul 18, 2007 at 9:03 AM
Hi lolic,
I still had no time to modify the tests.
Anyway this is the change I did in my build. You can test yourself and see if it's ok (if you wish).
Sorry for the delay ..

public void RejectChanges()
{
if(_CollectedObject is IEditableObject)
((IEditableObject)_CollectedObject).CancelEdit();

if(object.Equals(_Clone, default(T)))
{
if(Status == ObjectStatusType.Deleted)
{
_Status = ObjectStatusType.Normal;
_PropertyChanged(this, new PropertyChangedEventArgs(""));
}
return;
}
_CollectedObject = _Clone;
if(_CollectedObject is INotifyPropertyChanged) // INotifyPropertyChanging
_Clone = default(T);
else
SaveClone(true);
_Status = ObjectStatusType.Normal;
_PropertyChanged(this, new PropertyChangedEventArgs(""));
}