Exemple #1
0
        } // end method



        private static void SetParameterProperty(object parameter, string propertyName, object value) {
            var mirror = Mirror.mirrorCache[parameter.GetType()];
            var prop = mirror.GetProperty(propertyName);
            if (prop == null)
                return;

            value = SystemTool.SmartConvert(value, prop.PropertyType);
            prop.SetValue(parameter, value, null);
        } // end method
Exemple #2
0
        } // end method



        public static object Set(this IDbDataParameter parameter, object value, bool convert = false) {
            value = value ?? DBNull.Value;
            if (convert) {
                if (value != DBNull.Value)
                    value = SystemTool.SmartConvert(value, typeMap[parameter.DbType]);
                parameter.Value = value;
            } else {
                parameter.Value = value;
                parameter.DbType = dbTypeMap[value.GetType()];
            } // end if-else
            return value;
        } // end method