protected void OnPropertySet(string property, object oldValue, object newValue) { // Raise property change if the new value is different from the old value if (this.EntityState != System.Data.EntityState.Detached && ((oldValue == null ^ newValue == null) || (oldValue != null && !oldValue.Equals(newValue)))) { instance.OnPropertyChanged(property, oldValue, newValue); } }