Ejemplo n.º 1
0
        object IDictionaryPropertyGetter.GetPropertyValue(
            IDictionaryAdapter dictionaryAdapter,
            string key,
            object storedValue,
            PropertyDescriptor property,
            bool ifExists
            )
        {
            XmlAccessor accessor;

            if (TryGetAccessor(key, property, null != storedValue, out accessor))
            {
                storedValue = accessor.GetPropertyValue(
                    node,
                    dictionaryAdapter,
                    references,
                    !ifExists
                    );
                if (null != storedValue)
                {
                    AttachObservers(storedValue, dictionaryAdapter, property);
                    dictionaryAdapter.StoreProperty(property, key, storedValue);
                }
            }
            return(storedValue);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the property value.
        /// </summary>
        /// <param name="dictionaryAdapter">The dictionary adapter.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="descriptor">The descriptor.</param>
        /// <returns></returns>
        public bool SetPropertyValue(IDictionaryAdapter dictionaryAdapter, string key, ref object value, PropertyDescriptor descriptor)
        {
            key = GetKey(dictionaryAdapter, key, descriptor);

            var behaviors = dictionaryBehaviors;

            if (behaviors != null)
            {
                var count = behaviors.Count;
                for (int i = 0; i < count; i++)
                {
                    var setter = behaviors[i] as IDictionaryPropertySetter;
                    if (setter != null)
                    {
                        if (setter.SetPropertyValue(dictionaryAdapter, key, ref value, this) == false)
                        {
                            return(false);
                        }
                    }
                }
            }

            dictionaryAdapter.StoreProperty(this, key, value);
            return(true);
        }
Ejemplo n.º 3
0
 object IDictionaryPropertyGetter.GetPropertyValue(IDictionaryAdapter dictionaryAdapter, string key, object storedValue,
                                                   PropertyDescriptor property, bool ifExists)
 {
     if (ShouldIgnoreProperty(property) == false &&
         (storedValue == null || IsVolatileProperty(dictionaryAdapter, property)))
     {
         var result = EvaluateProperty(key, property, dictionaryAdapter);
         storedValue = ReadProperty(result, ifExists, dictionaryAdapter);
         if (storedValue != null)
         {
             dictionaryAdapter.StoreProperty(property, key, storedValue);
         }
     }
     return(storedValue);
 }
        /// <summary>
        /// Sets the property value.
        /// </summary>
        /// <param name="dictionaryAdapter">The dictionary adapter.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="descriptor">The descriptor.</param>
        /// <returns></returns>
        public bool SetPropertyValue(IDictionaryAdapter dictionaryAdapter,
                                     string key, ref object value, PropertyDescriptor descriptor)
        {
            key = GetKey(dictionaryAdapter, key, descriptor);

            if (setters != null)
            {
                foreach (var setter in setters)
                {
                    if (setter.SetPropertyValue(dictionaryAdapter, key, ref value, this) == false)
                    {
                        return(true);
                    }
                }
            }

            dictionaryAdapter.StoreProperty(this, key, value);
            return(true);
        }
Ejemplo n.º 5
0
		object IDictionaryPropertyGetter.GetPropertyValue(IDictionaryAdapter dictionaryAdapter, string key, object storedValue,
														  PropertyDescriptor property, bool ifExists)
		{
			if (ShouldIgnoreProperty(property) == false &&
				(storedValue == null || IsVolatileProperty(dictionaryAdapter, property)))
			{
				var result = EvaluateProperty(key, property, dictionaryAdapter);
				storedValue = ReadProperty(result, ifExists, dictionaryAdapter);
				if (storedValue != null)
				{
					dictionaryAdapter.StoreProperty(property, key, storedValue);
				}
			}
			return storedValue;
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Sets the property value.
		/// </summary>
		/// <param name="dictionaryAdapter">The dictionary adapter.</param>
		/// <param name="key">The key.</param>
		/// <param name="value">The value.</param>
		/// <param name="descriptor">The descriptor.</param>
		/// <returns></returns>
		public bool SetPropertyValue(IDictionaryAdapter dictionaryAdapter,
			string key, ref object value, PropertyDescriptor descriptor)
		{
			bool consumed = false;

			key = GetKey(dictionaryAdapter, key, descriptor);

			if (setters != null)
			{
				foreach(var setter in setters)
				{
					if (!setter.SetPropertyValue(dictionaryAdapter, key, ref value, this))
					{
						consumed = true;
					}
				}
			}

			if (descriptor != null && descriptor.Setters != null)
			{
				foreach (var setter in descriptor.Setters)
				{
					if (!setter.SetPropertyValue(dictionaryAdapter, key, ref value, this))
					{
						consumed = true;
					}
				}
			}

			if (!consumed)
			{
				dictionaryAdapter.StoreProperty(this, key, value);
			}

			return !consumed;
		}
Ejemplo n.º 7
0
		/// <summary>
		/// Sets the property value.
		/// </summary>
		/// <param name="dictionaryAdapter">The dictionary adapter.</param>
		/// <param name="key">The key.</param>
		/// <param name="value">The value.</param>
		/// <param name="descriptor">The descriptor.</param>
		/// <returns></returns>
		public bool SetPropertyValue(IDictionaryAdapter dictionaryAdapter,
			string key, ref object value, PropertyDescriptor descriptor)
		{
			key = GetKey(dictionaryAdapter, key, descriptor);

			if (setters != null)
			{
				foreach(var setter in setters)
				{
					if (setter.SetPropertyValue(dictionaryAdapter, key, ref value, this) == false)
					{
						return true;
					}
				}
			}

			dictionaryAdapter.StoreProperty(this, key, value);
			return true;
		}