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); }
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); }
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); }