Exemple #1
0
        private KeysRetriever BuildKeysRetriever(ColumnMappingCollection settings, Func <ColumnMapping, string> target)
        {
            var defColumns = new Collection <IColumnDefinition>();

            foreach (var setting in settings)
            {
                var defColumn = setting.ToColumnDefinition(() => target(setting));
                defColumns.Add(defColumn);
            }

            if (settings.Any(x => target(x).StartsWith("#")))
            {
                return(new KeysRetrieverByIndex(defColumns));
            }
            else
            {
                return(new KeysRetrieverByName(defColumns));
            }
        }
        private KeysRetriever BuildKeysRetriever(ColumnMappingCollection settings, Func <ColumnMapping, IColumnIdentifier> target)
        {
            var defColumns = new Collection <IColumnDefinition>();

            foreach (var setting in settings)
            {
                var defColumn = setting.ToColumnDefinition(() => target(setting));
                defColumns.Add(defColumn);
            }

            if (settings.Any(x => target(x) is ColumnOrdinalIdentifier))
            {
                return(new KeysRetrieverByOrdinal(defColumns));
            }
            else
            {
                return(new KeysRetrieverByName(defColumns));
            }
        }