Beispiel #1
0
        public IEnumerable <T> FindDocuments <T>(string filter)
        {
            checkloaded();
            WAHBitArray bits = ExecutionPlan(filter, _docs.RecordCount());

            // enumerate documents
            foreach (int i in bits.GetBitIndexes())
            {
                if (i > _lastDocNum - 1)
                {
                    break;
                }
                string b = _docs.ReadData(i);
                //T d = fastJSON.JSON.ToObject<T>(b, new fastJSON.JSONParameters { ParametricConstructorOverride = true }); //fastJSON
                T d = _json.DeserializeObject <T>(b);

                yield return(d);
            }
        }
Beispiel #2
0
        public object ReadObject(long recnum, out StorageItem <T> meta)
        {
            byte[] b = ReadBytes(recnum, out meta);

            if (b == null)
            {
                return(null);
            }
            if (b[0] < 32)
            {
                //return fastBinaryJSON.BJSON.ToObject(b);//fastBinaryJSON
                return(_bson.DeserializeObject <object>(b));
            }
            else
            {
                //return fastJSON.JSON.ToObject(Encoding.ASCII.GetString(b));//fastJSON
                //return JsonConvert.DeserializeObject(Encoding.ASCII.GetString(b));
                return(_json.DeserializeObject <object>(Encoding.ASCII.GetString(b)));
            }
        }