Quantcast
Channel: URF - Unit of Work & (extensible/generic) Repositories Framework
Viewing all articles
Browse latest Browse all 1539

New Post: How do you do projections while you do paging?

$
0
0
Using the Service pattern, how do you both project fewer fields and page? For example, this fails:
var query = _Service
     .Query( x => x.type == "company")
     .OrderBy( x => x.OrderBy( y => y.name)
     .Select( s => new DDL
          { text = s.name, id = s.id })
     .SelectPage( 2, 10, out totalCount);
The .SelectPage() produces an IEnumerable which grabs all the entity's fields, so we .Select() first to limit our fields to id and name, but then how would you select the second page of 10 records?

Viewing all articles
Browse latest Browse all 1539

Trending Articles