private static Exception CreateEntityParsingException <T>(RowValues values, IBulkMapping <T> mapping, Exception ex) { var entityType = typeof(T).Name; var simpleMapping = mapping as SimpleBulkMapping <T>; var message = simpleMapping != null ? string.Format("Couldn't parse column {0} of {1} entity: {2}", simpleMapping.CsvHeader, entityType, ex.Message) : string.Format("Couldn't parse {0} entity: {1}", entityType, ex.Message); message += " See ColumnValues for detailed row information and InnerException for error details."; return(new EntityReadException(message, values.ToDebugString(), ex)); }