protected override object CoreGetAlternativeValueFromId(DictionaryConfiguration dictionaryConfiguration, IMetaColumn metaColumn, object surrogateId)
        {
            object value;
            int    index;

            HeaderSpec[] headerSpecs;
            IEnumerable <IDictionary <string, object> > records;

            if ((object)dictionaryConfiguration == null)
            {
                throw new ArgumentNullException("dictionaryConfiguration");
            }

            if ((object)metaColumn == null)
            {
                throw new ArgumentNullException("metaColumn");
            }

            if ((object)surrogateId == null)
            {
                throw new ArgumentNullException("surrogateId");
            }

            if ((object)this.AdapterConfiguration.AdapterSpecificConfiguration.DelimitedTextSpec == null)
            {
                throw new InvalidOperationException(string.Format("Configuration missing: '{0}'.", "DelimitedTextSpec"));
            }

            if (DataTypeFascade.Instance.IsNullOrWhiteSpace(this.AdapterConfiguration.AdapterSpecificConfiguration.DelimitedTextFilePath))
            {
                throw new InvalidOperationException(string.Format("Configuration missing: '{0}'.", "DelimitedTextFilePath"));
            }

            using (RecordTextReader delimitedTextReader = new DelimitedTextReader(new StreamReader(File.Open(this.AdapterConfiguration.AdapterSpecificConfiguration.DelimitedTextFilePath, FileMode.Open, FileAccess.Read, FileShare.None)), this.AdapterConfiguration.AdapterSpecificConfiguration.DelimitedTextSpec))
            {
                index = surrogateId.ChangeType <int>() - 1;

                headerSpecs = delimitedTextReader.ReadHeaderSpecs().ToArray();
                records     = delimitedTextReader.ReadRecords();

                var record = records.ElementAtOrDefault(index);

                if ((object)record == null)
                {
                    value = null;
                }
                else
                {
                    value = record[headerSpecs[index].HeaderName];
                }
            }

            return(value);
        }
        protected override void CorePreloadCache(DictionaryConfiguration dictionaryConfiguration, IDictionary <string, IDictionary <long, object> > substitutionCacheRoot)
        {
            HeaderSpec[] headerSpecs;
            IEnumerable <IDictionary <string, object> > records;
            IDictionary <long, object> dictionaryCache;

            if ((object)dictionaryConfiguration == null)
            {
                throw new ArgumentNullException("dictionaryConfiguration");
            }

            if ((object)substitutionCacheRoot == null)
            {
                throw new ArgumentNullException("substitutionCacheRoot");
            }

            if ((object)this.AdapterConfiguration.AdapterSpecificConfiguration.DelimitedTextSpec == null)
            {
                throw new InvalidOperationException(string.Format("Configuration missing: '{0}'.", "DelimitedTextSpec"));
            }

            if (DataTypeFascade.Instance.IsNullOrWhiteSpace(this.AdapterConfiguration.AdapterSpecificConfiguration.DelimitedTextFilePath))
            {
                throw new InvalidOperationException(string.Format("Configuration missing: '{0}'.", "DelimitedTextFilePath"));
            }

            using (RecordTextReader delimitedTextReader = new DelimitedTextReader(new StreamReader(File.Open(this.AdapterConfiguration.AdapterSpecificConfiguration.DelimitedTextFilePath, FileMode.Open, FileAccess.Read, FileShare.None)), this.AdapterConfiguration.AdapterSpecificConfiguration.DelimitedTextSpec))
            {
                dictionaryCache = new Dictionary <long, object>();

                headerSpecs = delimitedTextReader.ReadHeaderSpecs().ToArray();
                records     = delimitedTextReader.ReadRecords();

                foreach (IDictionary <string, object> record in records)
                {
                    object[] values = record.Values.ToArray();
                    long     id     = values[0].ChangeType <long>();
                    object   value  = values[1].ChangeType <string>();

                    dictionaryCache.Add(id, value);
                }

                substitutionCacheRoot.Add(dictionaryConfiguration.DictionaryId, dictionaryCache);
            }
        }