/// <summary>
        /// Update the given model object with the given value using the column's
        /// AspectName.
        /// </summary>
        /// <param name="rowObject">The model object to be updated</param>
        /// <param name="newValue">The value to be put into the model</param>
        public void PutAspectByName(object rowObject, object newValue)
        {
            if (aspectMunger == null)
            {
                aspectMunger = new Munger(AspectName);
            }

            aspectMunger.PutValue(rowObject, newValue);
        }
        /// <summary>
        /// A helper method to put the given value into the given aspect of the given object.
        /// </summary>
        /// <remarks>This method catches and silently ignores any errors that occur
        /// while modifying the target object</remarks>
        /// <param name="target">The object to be modified</param>
        /// <param name="propertyName">The name of the property/field to be modified</param>
        /// <param name="value">The value to be assigned</param>
        /// <returns>Did the modification work?</returns>
        public static bool PutProperty(object target, string propertyName, object value)
        {
            try {
                Munger munger = new Munger(propertyName);
                return(munger.PutValue(target, value));
            }
            catch (MungerException) {
                // Not a lot we can do about this. Something went wrong in the bowels
                // of the property. Let's take the ostrich approach and just ignore it :-)
            }

            return(false);
        }
Example #3
0
        /// <summary>
        /// A helper method to put the given value into the given aspect of the given object.
        /// </summary>
        /// <remarks>This method catches and silently ignores any errors that occur
        /// while modifying the target object</remarks>
        /// <param name="target">The object to be modified</param>
        /// <param name="propertyName">The name of the property/field to be modified</param>
        /// <param name="value">The value to be assigned</param>
        /// <returns>Did the modification work?</returns>
        public static bool PutProperty(object target, string propertyName, object value)
        {
            try {
                Munger munger = new Munger(propertyName);
                return(munger.PutValue(target, value));
            }
            catch (MungerException) {
                // Not a lot we can do about this. Something went wrong in the bowels
                // of the property. Let's take the ostrich approach and just ignore it :-)

                // Normally, we would never just silently ignore an exception.
                // However, in this case, this is a utility method that explicitly
                // contracts to catch and ignore errors. If this is not acceptable,
                // the programmer should not use this method.
            }

            return(false);
        }
Example #4
0
File: Munger.cs Project: VicBoss/KR
        /// <summary>
        /// A helper method to put the given value into the given aspect of the given object.
        /// </summary>
        /// <remarks>This method catches and silently ignores any errors that occur
        /// while modifying the target object</remarks>
        /// <param name="target">The object to be modified</param>
        /// <param name="propertyName">The name of the property/field to be modified</param>
        /// <param name="value">The value to be assigned</param>
        /// <returns>Did the modification work?</returns>
        public static bool PutProperty(object target, string propertyName, object value) {
            try {
                Munger munger = new Munger(propertyName);
                return munger.PutValue(target, value);
            }
            catch (MungerException) {
                // Not a lot we can do about this. Something went wrong in the bowels
                // of the property. Let's take the ostrich approach and just ignore it :-)
            } 

            return false;
        }
Example #5
0
        /// <summary>
        /// A helper method to put the given value into the given aspect of the given object.
        /// </summary>
        /// <remarks>This method catches and silently ignores any errors that occur
        /// while modifying the target object</remarks>
        /// <param name="target">The object to be modified</param>
        /// <param name="propertyName">The name of the property/field to be modified</param>
        /// <param name="value">The value to be assigned</param>
        /// <returns>Did the modification work?</returns>
        public static bool PutProperty(object target, string propertyName, object value) {
            try {
                Munger munger = new Munger(propertyName);
                return munger.PutValue(target, value);
            }
            catch (MungerException) {
                // Not a lot we can do about this. Something went wrong in the bowels
                // of the property. Let's take the ostrich approach and just ignore it :-)

                // Normally, we would never just silently ignore an exception.
                // However, in this case, this is a utility method that explicitly
                // contracts to catch and ignore errors. If this is not acceptible,
                // the programmer should not use this method.
            }

            return false;
        }