示例#1
0
 /// <summary>
 ///     Sets the value.
 /// </summary>
 /// <typeparam name="T"> </typeparam>
 /// <param name="container"> The container. </param>
 /// <param name="property"> The property. </param>
 /// <param name="value"> The value. </param>
 public static void SetValue <T> (this IStateMetaContainer container, IStateMetaProperty property, T value)
 {
     if (container == null)
     {
         throw new ArgumentNullException("container");
     }
     if (property == null)
     {
         throw new ArgumentNullException("property");
     }
     container.SetValue(property, value);
 }
示例#2
0
 /// <summary>
 ///     Gets the value.
 /// </summary>
 /// <typeparam name="T"> </typeparam>
 /// <param name="container"> The container. </param>
 /// <param name="property"> The property. </param>
 /// <returns> </returns>
 public static T GetValue <T> (this IStateMetaContainer container, IStateMetaProperty property)
 {
     if (container == null)
     {
         throw new ArgumentNullException("container");
     }
     if (property == null)
     {
         throw new ArgumentNullException("property");
     }
     return(( T )container.GetValue(property));
 }
示例#3
0
        /// <summary>
        ///     Sets the value.
        /// </summary>
        /// <param name="data"> The data. </param>
        /// <param name="value"> The value. </param>
        public void SetValue(IStateMetaProperty data, object value)
        {
            if (value != null && data.Type != value.GetType( ))
            {
                throw new Exception("Value provided does not match the meta property value type");
            }

            if (_values.ContainsKey(data.ID))
            {
                _values.Remove(data.ID);
            }

            _values.Add(data.ID, value);
        }
示例#4
0
 /// <summary>
 ///     Gets the value.
 /// </summary>
 /// <param name="data"> The data. </param>
 /// <returns> </returns>
 public object GetValue(IStateMetaProperty data)
 {
     return(_values.ContainsKey(data.ID) ? _values [data.ID] : data.Default);
 }