Using Query.ResultLimit with DomainDataSource

Using Query.ResultLimit with DomainDataSource

Rate This
  • Comments 2

Server throttling is one the new features we introduced in our RC release.  It lets you regulate the per request load on the server / DB by specifying maximum result limit on a query method using the QueryAttribute.ResultLimit property.

Here is how you can specify a result limit on a query method:-

   1: [Query(ResultLimit=1000)]
   2: public IQueryable<Customer> GetCustomers()
   3: {
   4:     return this.ObjectContext.Customers;
   5: }

The result limit query only applies to the top level entities, so the above query will result in returning 1000 top level entities. This limit will not apply to the included entities.

As you will notice, the ResultLimit will not be propagated to the client. Things get really interesting when you use DomainDataSource especially when you are using LoadSize and PageSize.

Keep the following in mind, if you are developing an application that happens to have a query limit and uses DomainDataSource on the client:-

  1. Choose the ResultLimit appropriately.
  2. Configure your client to pull data in chunks (DomainDataSource supports this through the LoadSize property).
  3. The load size should be less than or equal to your server query result limit.
  4. Do not have a page size that is greater than the result limit.
  5. It is good practice to have a LoadSize that is a multiple of PageSize.

Here is an example on how to specify LoadSize and PageSize on DomainDataSource

   1: <riaControls:DomainDataSource 
   2:             AutoLoad="True" 
   3:             LoadSize="20" 
   4:             PageSize="10" 
   5:             Name="customerDataDomainDataSource" 
   6:             QueryName="GetCustomersQuery" 
   7:             Width="0">
   8:     <riaControls:DomainDataSource.DomainContext>
   9:         <my:CustomerContext/>
  10:     </riaControls:DomainDataSource.DomainContext>
  11: </riaControls:DomainDataSource>

Cheers!

Leave a Comment
  • Please add 6 and 7 and type the answer here:
  • Post
  • Dude,

    Your point 5 belies your example.

    PageSize="10" is not a multiple, i.e. mathematical product, of LoadSize="20".

    Shouldn't it be the other way around?  Please, advise.

  • Thanks !! corrected it.

Page 1 of 1 (2 items)