Exemplo n.º 1
0
        protected object GetValueForConfig(ColumnPropertySourceConfiguration config, TReader tableReader)
        {
            if (config == null)
            {
                return(null);
            }
            string rawValue = null;

            if (Configuration.HasHeaderRow && config.ColumnName != null)
            {
                rawValue = GetValueByColumnName(tableReader, config.ColumnName);
            }
            else if (config.ColumnIndex.HasValue)
            {
                rawValue = GetValueByColumnIndex(tableReader, config.ColumnIndex.Value);
            }
            else
            {
                throw new ArgumentException(
                          "No column index given although name couldn't be used as index or index is prefered",
                          "ColumnIndex");
            }
            Debug.Assert(config.ColumnIndex != null, "config.ColumnIndex != null");

            var parser = config.ResolveParser(Context);

            return(parser.Parse(rawValue));
        }
Exemplo n.º 2
0
 protected bool Equals(ColumnPropertySourceConfiguration other)
 {
     return(base.Equals(other) && string.Equals(ColumnName, other.ColumnName) && ColumnIndex == other.ColumnIndex);
 }