コード例 #1
0
        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));
        }
コード例 #2
0
        private static Exception CreateEntityWriteException <T>(IBulkMapping <T> mapping, Exception ex)
        {
            var entityType = typeof(T).Name;

            var simpleMapping = mapping as SimpleBulkMapping <T>;

            var message = simpleMapping != null
                ? string.Format("Couldn't write column {0} of {1} entity: {2}", simpleMapping.CsvHeader, entityType, ex.Message)
                : string.Format("Couldn't write {0} entity: {1}", entityType, ex.Message);

            message += " See InnerException for error details.";

            return(new EntityWriteException(message, ex));
        }