/// <summary> /// Gets the property value. /// </summary> /// <param name="dictionaryAdapter">The dictionary adapter.</param> /// <param name="key">The key.</param> /// <param name="storedValue">The stored value.</param> /// <param name="descriptor">The descriptor.</param> /// <param name="ifExists">true if return only existing.</param> public object GetPropertyValue( IDictionaryAdapter dictionaryAdapter, string key, object storedValue, PropertyDescriptor descriptor, bool ifExists ) { key = GetKey(dictionaryAdapter, key, descriptor); storedValue = storedValue ?? dictionaryAdapter.ReadProperty(key); var behaviors = dictionaryBehaviors; if (behaviors != null) { var count = behaviors.Count; for (int i = 0; i < count; i++) { var getter = behaviors[i] as IDictionaryPropertyGetter; if (getter != null) { storedValue = getter.GetPropertyValue( dictionaryAdapter, key, storedValue, this, IfExists || ifExists ); } } } return(storedValue); }
bool IDictionaryPropertySetter.SetPropertyValue(IDictionaryAdapter dictionaryAdapter, string key, ref object value, PropertyDescriptor property) { XmlAccessor accessor; if (TryGetAccessor(key, property, false, out accessor)) { if (value != null && dictionaryAdapter.ShouldClearProperty(property, value)) { value = null; } var oldValue = dictionaryAdapter.ReadProperty(key); accessor.SetPropertyValue(node, dictionaryAdapter, references, oldValue, ref value); } return(true); }
/// <summary> /// Gets the property value. /// </summary> /// <param name="dictionaryAdapter">The dictionary adapter.</param> /// <param name="key">The key.</param> /// <param name="storedValue">The stored value.</param> /// <param name="descriptor">The descriptor.</param> /// <param name="ifExists">true if return only existing.</param> /// <returns></returns> public object GetPropertyValue(IDictionaryAdapter dictionaryAdapter, string key, object storedValue, PropertyDescriptor descriptor, bool ifExists) { key = GetKey(dictionaryAdapter, key, descriptor); storedValue = storedValue ?? dictionaryAdapter.ReadProperty(key); if (getters != null) { foreach (var getter in getters) { storedValue = getter.GetPropertyValue(dictionaryAdapter, key, storedValue, this, ifExists); } } return(storedValue); }
/// <summary> /// Gets the property value. /// </summary> /// <param name="dictionaryAdapter">The dictionary adapter.</param> /// <param name="key">The key.</param> /// <param name="storedValue">The stored value.</param> /// <param name="descriptor">The descriptor.</param> /// <param name="ifExists">true if return only existing.</param> /// <returns></returns> public object GetPropertyValue(IDictionaryAdapter dictionaryAdapter, string key, object storedValue, PropertyDescriptor descriptor, bool ifExists) { key = GetKey(dictionaryAdapter, key, descriptor); storedValue = storedValue ?? dictionaryAdapter.ReadProperty(key); if (getters != null) { foreach (var getter in getters) { storedValue = getter.GetPropertyValue(dictionaryAdapter, key, storedValue, this, ifExists); } } if (descriptor != null && descriptor.Getters != null) { foreach (var getter in descriptor.Getters) { storedValue = getter.GetPropertyValue(dictionaryAdapter, key, storedValue, this, ifExists); } } return storedValue; }