protected override bool WriteEnforceRule(ICorePropertyBag propertyBag) { bool flag = false; object obj = null; foreach (PropertyDefinition propertyDefinition in base.ReadProperties) { if (propertyBag.IsPropertyDirty(propertyDefinition)) { flag = true; obj = propertyBag.TryGetProperty(propertyDefinition); if (!PropertyError.IsPropertyNotFound(obj)) { break; } } } if (flag) { foreach (PropertyDefinition property in base.WriteProperties) { propertyBag.SetOrDeleteProperty(property, obj); } } return(flag); }
protected override bool WriteEnforceRule(ICorePropertyBag propertyBag) { bool result = false; if (propertyBag.IsPropertyDirty(this.primary)) { propertyBag.SetOrDeleteProperty(this.secondary, propertyBag.TryGetProperty(this.primary)); result = true; } return(result); }
protected sealed override bool WriteEnforceRule(ICorePropertyBag propertyBag) { bool result = false; object propertyValue = propertyBag.TryGetProperty(this.propertyToSet); if (PropertyError.IsPropertyNotFound(propertyValue)) { propertyBag.SetOrDeleteProperty(this.propertyToSet, this.defaultValue); result = true; } return(result); }
protected sealed override bool WriteEnforceRule(ICorePropertyBag propertyBag) { bool result = false; bool isPropertyDirty = propertyBag.IsPropertyDirty(this.propertyToSet); object propertyValue = propertyBag.TryGetProperty(this.propertyToSet); if (this.ShouldEnforce(isPropertyDirty, propertyValue)) { TSet valueOrDefault = propertyBag.GetValueOrDefault <TSet>(this.propertyToSet); TDepend valueOrDefault2 = propertyBag.GetValueOrDefault <TDepend>(this.propertyToDepend); TSet tset; if (this.CalculateValue(valueOrDefault2, valueOrDefault, out tset) && (PropertyError.IsPropertyNotFound(propertyValue) || !object.Equals(tset, valueOrDefault))) { propertyBag.SetOrDeleteProperty(this.propertyToSet, tset); result = true; } } return(result); }