public void Delete(TKey fromKey, TKey toKey) { IData ifrom = KeyTransformer.To(fromKey); IData ito = KeyTransformer.To(toKey); Table.Delete(ifrom, ito); }
public void InsertOrIgnore(TKey key, TRecord record) { IData ikey = KeyTransformer.To(key); IData irec = RecordTransformer.To(record); Table.InsertOrIgnore(ikey, irec); }
public void Replace(TKey key, TRecord record) { IData ikey = KeyTransformer.To(key); IData irec = RecordTransformer.To(record); Table.Replace(ikey, irec); }
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); }
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)); } }
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); }
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)); }
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); }
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; } }
public bool Exists(TKey key) { IData ikey = KeyTransformer.To(key); return(Table.Exists(ikey)); }
public void Delete(TKey key) { IData ikey = KeyTransformer.To(key); Table.Delete(ikey); }