// extract value from row in common type object GetDatarowValue(DataRow row, string fieldname, CommonType ctype) { try { var value = row[fieldname]; return((value == null || value == DBNull.Value) ? CommonConverter.GetDefault(ctype) : value); } catch (Exception) { throw Error.Fatal($"bad field {fieldname}"); } }
// extract reader value in common type object GetReaderValue(DbDataReader rdr, string fieldname, CommonType ctype) { var field = rdr.GetOrdinal(fieldname); if (rdr.IsDBNull(field)) { return(CommonConverter.GetDefault(ctype)); } else { return(rdr.GetValue(field)); } }