示例#1
0
        public override void SetUnmodified()
        {
            if (this.Context == null)
            {
                throw new InvalidOperationException("Cannot set object to Unmodified when object has no Context");
            }

            if (!_ObjectState.In(DataObjectState.Detached, DataObjectState.New, DataObjectState.Modified, DataObjectState.Unmodified))
            {
                throw new InvalidOperationException("Cannot set object to Unmodified when in State " + _ObjectState.ToString());
            }

            SetObjectState(DataObjectState.Unmodified);
        }
示例#2
0
        private void SetObjectState(DataObjectState newState)
        {
            var oldValue = this._ObjectState;

            NotifyPropertyChanging("ObjectState", oldValue, newState);
            this._ObjectState = newState;
            if (this.Context != null && newState.In(DataObjectState.Modified, DataObjectState.Deleted))
            {
                this.Context.Internals().SetModified(this);
            }
            NotifyPropertyChanged("ObjectState", oldValue, newState);
        }
示例#3
0
 private void SetObjectState(DataObjectState newState)
 {
     var oldValue = this._ObjectState;
     NotifyPropertyChanging("ObjectState", oldValue, newState);
     this._ObjectState = newState;
     if (this.Context != null && newState.In(DataObjectState.Modified, DataObjectState.Deleted))
         this.Context.Internals().SetModified(this);
     NotifyPropertyChanged("ObjectState", oldValue, newState);
 }