예제 #1
0
        IValueSource IColumnMapping.ValueSource(CsvData data, CsvData headers)
        {
            var mapping    = this.As <IColumnMapping>();
            var badColumns = new List <string>();

            var columns = headers
                          .Values
                          .Select(x => {
                var column = mapping.ColumnFor(x);
                if (column == null)
                {
                    badColumns.Add(x);
                }

                return(column);
            }).ToArray();

            if (badColumns.Any())
            {
                throw new CsvColumnException(badColumns);
            }

            return(data.ToValueSource(columns));
        }
예제 #2
0
 IValueSource IColumnMapping.ValueSource(CsvData data)
 {
     return(data.ToValueSource(_columns));
 }