Example #1
0
 protected override T TryGetInternal()
 {
     if (!db.TryGet(ReadOptions.Default, prefix, out Slice slice))
     {
         return(null);
     }
     return(slice.ToArray().AsSerializable <T>());
 }
Example #2
0
        public static T TryGet <T>(this DB db, ReadOptions options, byte prefix, ISerializable key) where T : class, ISerializable, new()
        {
            Slice slice;

            if (!db.TryGet(options, SliceBuilder.Begin(prefix).Add(key), out slice))
            {
                return(null);
            }
            return(slice.ToArray().AsSerializable <T>());
        }
Example #3
0
        public static T TryGet <T>(this DB db, ReadOptions options, byte prefix, ISerializable key, Func <Slice, T> resultSelector) where T : class
        {
            Slice slice;

            if (!db.TryGet(options, SliceBuilder.Begin(prefix).Add(key), out slice))
            {
                return(null);
            }
            return(resultSelector(slice));
        }
Example #4
0
 protected override TValue TryGetInternal(TKey key)
 {
     return(db.TryGet <TValue>(ReadOptions.Default, prefix, key));
 }