コード例 #1
0
        private void AddPropertyMapping <TProperty>(int columnIndex, CsvPropertyMapping <TEntity, TProperty> propertyMapping)
        {
            var indexToPropertyMapping = new IndexToPropertyMapping
            {
                ColumnIndex     = columnIndex,
                PropertyMapping = propertyMapping
            };

            csvIndexPropertyMappings.Add(indexToPropertyMapping);
        }
コード例 #2
0
ファイル: CsvMapping.cs プロジェクト: felpasl/TinyCsvParser
        protected CsvPropertyMapping <TEntity, TProperty> MapProperty <TProperty>(int columnIndex, Expression <Func <TEntity, TProperty> > property, ITypeConverter <TProperty> typeConverter)
        {
            if (csvPropertyMappings.Any(x => x.ColumnIndex == columnIndex))
            {
                throw new InvalidOperationException(string.Format("Duplicate mapping for column index {0}", columnIndex));
            }

            var propertyMapping = new CsvPropertyMapping <TEntity, TProperty>(property, typeConverter);

            AddPropertyMapping(columnIndex, propertyMapping);

            return(propertyMapping);
        }