private T ChangeType <T>(object o, TypeCode typeCode) { if (DataHelper.IsNullOrDBNull(o)) { return(default(T)); } return((T)Convert.ChangeType(o, typeCode, System.Globalization.CultureInfo.InvariantCulture)); }
public static QConditionNode operator !=(QField lvalue, IQueryValue rvalue) { if (rvalue == null || ((rvalue is QConst && !(rvalue is QVar)) && DataHelper.IsNullOrDBNull(((QConst)rvalue).Value))) { return(new QConditionNode(lvalue, Conditions.Null | Conditions.Not, null)); } return(new QConditionNode(lvalue, Conditions.Equal | Conditions.Not, rvalue)); }
internal void MapTo(IDataRecord record, object o, Type type, PocoModelSchema schema) { for (int i = 0; i < record.FieldCount; i++) { var fieldName = record.GetName(i); var colMapping = schema.GetColumnMapping(fieldName); if (colMapping == null || colMapping.SetVal == null) { continue; } var fieldValue = record.GetValue(i); if (DataHelper.IsNullOrDBNull(fieldValue)) { fieldValue = null; if (Nullable.GetUnderlyingType(colMapping.ValueType) == null && colMapping.ValueType._IsValueType()) { fieldValue = colMapping.DefaultValue; } } colMapping.SetValue(o, fieldValue); } }