Esempio n. 1
0
        private void AddPropertyMapping <TProperty>(int columnIndex, CsvPropertyMapping <TEntity, TProperty> propertyMapping)
        {
            var indexToPropertyMapping = new IndexToPropertyMapping
            {
                ColumnIndex     = columnIndex,
                PropertyMapping = propertyMapping
            };

            csvIndexPropertyMappings.Add(indexToPropertyMapping);
        }
Esempio n. 2
0
        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);
        }