Beispiel #1
0
        public static void CancelEdit(this IEditableObject self)
        {
            // restore state from temporary storage, discard temporary state
            var    state = self.GetInternalState();
            object clone;

            if (!state.TryGetValue(SystemFields.Shapshot, out clone))
            {
                return;                                                       // idempotent
            }
            ((IMapper)clone).MapTo(self, true, true);
            State.Remove(clone);
            state.Remove(SystemFields.Shapshot);
        }
Beispiel #2
0
        public static void EndEdit(this IEditableObject self)
        {
            // accept current state, discard old state
            var    state = self.GetInternalState();
            object clone;

            if (!state.TryGetValue(SystemFields.Shapshot, out clone))
            {
                return;                                                       // idempotent
            }
            State.Remove(clone);
            state.Remove(SystemFields.Shapshot);

            self.SetProperty(SystemFields.IsChanged, false);
        }