Пример #1
0
        public virtual List <T> Search <T>(SearchFilter filter) where T : IHasId
        {
            Condition.Requires(filter).IsNotNull();
            List <T> list = new List <T>();

            this.JSONObject.WithEach(x =>
            {
                try
                {
                    //get the store item
                    SerializedIHasId item = JsonSerializer.DeserializeFromString <SerializedIHasId>(x.Value);

                    //test the nested object
                    if (item != null)
                    {
                        T t = (T)item.GetStoredItem();

                        if (filter.Filter(t))
                        {
                            list.Add(t);
                        }
                    }
                }
                catch { }
            });
            return(list);
        }
Пример #2
0
        public virtual List <IHasId> GetAll()
        {
            List <IHasId> list = new List <IHasId>();

            this.JSONObject.WithEach(x =>
            {
                try
                {
                    //get the store item
                    SerializedIHasId item = JsonSerializer.DeserializeFromString <SerializedIHasId>(x.Value);

                    //test the nested object
                    if (item != null)
                    {
                        list.Add(item.GetStoredItem());
                    }
                }
                catch { }
            });
            return(list);
        }