Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
        public TSummaryPackageType Query(QuerySpecification qs)
        {
            var pk = new TSummaryPackageType();

            using (var dc = DocumentStoreLocator.ContextualResolve())
            {
                var q = dc.Query <TDataType>();

                q.ApplySpecFilter(qs);
                q = (IRavenQueryable <TDataType>)_contextFilter.ApplyContextFilter(q);

                var pbm = new RavenPageBookmark(qs.BookMark);
                q = q.Page(pbm);

                var items = q.Select(d => _summarizer.Summarize(d)).ToList();
                pk.Bookmark = pbm;
                pk.Items    = items;
                pk.Metadata = _summaryMetadataSource.Metadata;
            }

            return(pk);
        }