public void SetParameter(ParameterProperty mapping, IDataParameter dataParameter, object parameterValue) { object data = this._dataExchange.GetData(mapping, parameterValue); ITypeHandler typeHandler = mapping.TypeHandler; if (mapping.HasNullValue && typeHandler.Equals(data, mapping.NullValue)) { data = null; } typeHandler.SetParameter(dataParameter, data, mapping.DbType); }
/// <summary> /// Set parameter value, replace the null value if any. /// </summary> /// <param name="mapping"></param> /// <param name="dataParameter"></param> /// <param name="parameterValue"></param> public void SetParameter(ParameterProperty mapping, IDataParameter dataParameter, object parameterValue) { object value = dataExchange.GetData(mapping, parameterValue); ITypeHandler typeHandler = mapping.TypeHandler; // Apply Null Value if (mapping.HasNullValue) { if (typeHandler.Equals(value, mapping.NullValue)) { value = null; } } typeHandler.SetParameter(dataParameter, value, mapping.DbType); }