Example #1
0
        // Will handle paging at a later time
        //public IObservable<RepoItemCollection<T>> GetItems(int cursor = 0, int count = 1000, bool fetchOnline = false)
        //{
        //    return _childQuery
        //        .OrderByKey()
        //        .StartAt(cursor.ToString())
        //        .LimitToFirst(count)
        //        .OnceAsync<T>()
        //        .ToObservable()
        //        .SelectMany(x => x)
        //        .Skip(cursor > -1 ? 1 : 0)
        //        .Do(MapKeyToId)
        //        .Select(x => x.Object)
        //        .ToList()
        //        .Select(x => new RepoItemCollection<T>(int.Parse(x[x.Count - 1].Id), x));
        //}

        public IObservable <T> Observe()
        {
            return(_childQuery
                   .AsObservable <T>()
                   .Do(MapKeyToId)
                   .Select(x => x.Object));
        }