Esempio n. 1
0
        public void Delete(TKey fromKey, TKey toKey)
        {
            IData ifrom = KeyTransformer.To(fromKey);
            IData ito   = KeyTransformer.To(toKey);

            Table.Delete(ifrom, ito);
        }
Esempio n. 2
0
        public void InsertOrIgnore(TKey key, TRecord record)
        {
            IData ikey = KeyTransformer.To(key);
            IData irec = RecordTransformer.To(record);

            Table.InsertOrIgnore(ikey, irec);
        }
Esempio n. 3
0
        public void Replace(TKey key, TRecord record)
        {
            IData ikey = KeyTransformer.To(key);
            IData irec = RecordTransformer.To(record);

            Table.Replace(ikey, irec);
        }
Esempio n. 4
0
        public TRecord TryGetOrDefault(TKey key, TRecord defaultRecord)
        {
            IData ikey        = KeyTransformer.To(key);
            IData idefaultRec = RecordTransformer.To(defaultRecord);
            IData irec        = Table.TryGetOrDefault(ikey, idefaultRec);

            TRecord record = RecordTransformer.From(irec);

            return(record);
        }
Esempio n. 5
0
        public IEnumerable <KeyValuePair <TKey, TRecord> > Backward(TKey to, bool hasTo, TKey from, bool hasFrom)
        {
            IData ito   = hasTo ? KeyTransformer.To(to) : null;
            IData ifrom = hasFrom ? KeyTransformer.To(from) : null;

            foreach (var kv in Table.Backward(ito, hasTo, ifrom, hasFrom))
            {
                TKey    key = KeyTransformer.From(kv.Key);
                TRecord rec = RecordTransformer.From(kv.Value);

                yield return(new KeyValuePair <TKey, TRecord>(key, rec));
            }
        }
Esempio n. 6
0
        public TRecord Find(TKey key)
        {
            IData ikey = KeyTransformer.To(key);

            IData irec = Table.Find(ikey);

            if (irec == null)
            {
                return(default(TRecord));
            }

            TRecord record = RecordTransformer.From(irec);

            return(record);
        }
Esempio n. 7
0
        public KeyValuePair <TKey, TRecord>?FindBefore(TKey key)
        {
            IData ikey = KeyTransformer.To(key);

            KeyValuePair <IData, IData>?kv = Table.FindBefore(ikey);

            if (!kv.HasValue)
            {
                return(null);
            }

            TKey    k = KeyTransformer.From(kv.Value.Key);
            TRecord r = RecordTransformer.From(kv.Value.Value);

            return(new KeyValuePair <TKey, TRecord>(k, r));
        }
Esempio n. 8
0
        public bool TryGet(TKey key, out TRecord record)
        {
            IData ikey = KeyTransformer.To(key);

            IData irec;

            if (!Table.TryGet(ikey, out irec))
            {
                record = default(TRecord);
                return(false);
            }

            record = RecordTransformer.From(irec);

            return(true);
        }
Esempio n. 9
0
        public TRecord this[TKey key]
        {
            get
            {
                IData ikey = KeyTransformer.To(key);
                IData irec = Table[ikey];

                return(RecordTransformer.From(irec));
            }
            set
            {
                IData ikey = KeyTransformer.To(key);
                IData irec = RecordTransformer.To(value);

                Table[ikey] = irec;
            }
        }
Esempio n. 10
0
        public bool Exists(TKey key)
        {
            IData ikey = KeyTransformer.To(key);

            return(Table.Exists(ikey));
        }
Esempio n. 11
0
        public void Delete(TKey key)
        {
            IData ikey = KeyTransformer.To(key);

            Table.Delete(ikey);
        }