private void AddPropertyMapping <TProperty>(int columnIndex, CsvPropertyMapping <TEntity, TProperty> propertyMapping) { var indexToPropertyMapping = new IndexToPropertyMapping { ColumnIndex = columnIndex, PropertyMapping = propertyMapping }; csvIndexPropertyMappings.Add(indexToPropertyMapping); }
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); }