private void SetValueWithEvents <T>(T property, object newValue, Action <T, Object, Object> action) where T : StructuralProperty { var oldValue = GetValue(property); if (Object.Equals(oldValue, newValue)) { return; } if (!EntityAspect.FireEntityChanging(EntityAction.PropertyChange)) { return; } action(property, newValue, oldValue); EntityAspect.OnPropertyChanged(this.ParentEntityProperty); if (this.IsAttached) { if (!EntityManager.IsLoadingEntity) { if (this.EntityState == EntityState.Unchanged) { EntityAspect.SetModified(); } } // TODO: implement this. //if (entityManager.validationOptions.validateOnPropertyChange) { // entityAspect._validateProperty(newValue, // { entity: entity, property: property, propertyName: propPath, oldValue: oldValue }); //} } }