Thursday, March 18, 2010

Using Query.ResultLimit with DomainDataSource


   1: [Query(ResultLimit=1000)]
   2: public IQueryable GetCustomers()
   3: {
   4:     return this.ObjectContext.Customers;
   5: }
Source and explanations: http://blogs.msdn.com/deepm/archive/2010/03/16/using-query-resultlimit-with-domaindatasource.aspx
If I create another Query function that uses the above query, it'll receive ALL records, not the first 1000. So I have to add [Query(ResultLimit=1000)] to each and every query.
   1: public IQueryable GetCustomersByName(string name)
   2: {
   3:     return this.GetCustomers().where(c=>c.Name.StartsWith(name));
   4: }

No comments:

Post a Comment