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:-
2: public IQueryable<Customer> GetCustomers()
4: return this.ObjectContext.Customers;
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:-
- Choose the ResultLimit appropriately.
- Configure your client to pull data in chunks (DomainDataSource supports this through the LoadSize property).
- The load size should be less than or equal to your server query result limit.
- Do not have a page size that is greater than the result limit.
- 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