Ejemplo n.º 1
0
 /// <summary>
 /// Construct an item array of values gathered from the supplied instance. The item array
 /// is used to batch set all the values in a DataView row.
 /// </summary>
 /// <param name="instance">The instance whose property values are used</param>
 /// <returns>The item array</returns>
 private object[] GetItemArray(object instance)
 {
     object[] result = new object[viewMaps.Count];
     foreach (ViewMap vm in viewMaps)
     {
         // insert empty strings if null values are encountered
         object columnValue = map.GetMemberValue(instance, vm.PropertyName, typeof(string), false);
         if (vm.FormatString != null)
         {
             result[vm.ColumnIndex] = String.Format(vm.FormatString, columnValue);
         }
         else
         {
             result[vm.ColumnIndex] = columnValue;
         }
     }
     return(result);
 }
        public bool Validate(object obj)
        {
            object val = map.GetMemberValue(obj, propertyName, propertyType, true);

            return(va.Validate(propertyName, val, obj));
        }