Beispiel #1
0
        public TSummaryPackageType Query(QuerySpecification qs)
        {
            var pk = new TSummaryPackageType();

            var q = _data.Values.AsQueryable();

            q.ApplySpecFilter(qs);
            q = _contextFilter.ApplyContextFilter(q);

            var pbm = new GenericPageBookmark(qs.BookMark);

            q = GenericPaging.Page(q, pbm);

            var items = q.Select(d => _summarizer.Summarize(d)).ToList();

            pbm.Forward();
            pbm.More = items.Any();

            pk.Bookmark = pbm;
            pk.Items    = items;
            pk.Metadata = _summaryMetadataSource.Metadata;


            return(pk);
        }
Beispiel #2
0
        public TSummaryPackageType Query(QuerySpecification qs)
        {
            IEnumerable <TDataType> allData;

            using (var trx = _client.BeginTransaction())
            {
                var tbl = _client.OpenTable <TDataType>(_tableId);

                allData = tbl.Fetch(tbl.Keys.ToArray()).EmptyIfNull().Select(ra => ra.Data);
            }

            var pk = new TSummaryPackageType();

            var q = allData.AsQueryable();

            q.ApplySpecFilter(qs);
            q = _contextFilter.ApplyContextFilter(q);

            var pbm = new GenericPageBookmark(qs.BookMark);

            q = GenericPaging.Page(q, pbm);

            var items = q.Select(d => _summarizer.Summarize(d)).ToList();

            pk.Bookmark = pbm;
            pk.Items    = items;
            pk.Metadata = _summaryMetadataSource.Metadata;


            return(pk);
        }