예제 #1
0
        public IRelationalRow IndexedLookup(string indexName, int key)
        {
            if (key == 0)
            {
                return(null);
            }

            RelationalDataIndex <T> index = _indexes.GetOrAdd(indexName, i => {
                RelationalColumn column = Header.FindColumn(indexName);
                if (column == null)
                {
                    throw new KeyNotFoundException();
                }

                return(new RelationalDataIndex <T>(this, column));
            });

            return(index[key]);
        }
예제 #2
0
        public IRelationalRow IndexedLookup(string indexName, int key)
        {
            if (key == 0)
            {
                return(null);
            }

            if (!_indexes.TryGetValue(indexName, out var index))
            {
                var column = Header.FindColumn(indexName);
                if (column == null)
                {
                    throw new KeyNotFoundException();
                }

                _indexes[indexName] = index = new RelationalDataIndex <T>(this, column);
            }

            return(index[key]);
        }