views:

6

answers:

1

We're using a custom data access layer to read our domain objects (customers, orders, etc) from a database. This data access layer does not support paging or sorting.

We want to publish parts of the data (for instance customers) to a Silverlight client, using WCF RIA Services. In the client, we want to display a data grid with paging.

Now, in our RIA DomainService, we will have a function such as

IQueryable<Customer> GetCustomers()
{
   List<Customer> customers = OurPersisteceLayer.GetAllCustomers();
   return customers.AsQueryable()
}

This function will read all customer records from the database. I assume RIA can't do any form of server-side paging in this scenario - We will always read all customers when the function is called.

My questions are:

Will RIA cache the customer list in the client (and call GetCustomers only once), or will it execute the operation every time a user moves to the next page in the data grid?

In my scenario, the operation may take 5 seconds to execute which would be acceptable if it's done once, but not if it takes 5 seconds every time the user wants to move to a new page in the data grid.

Is there some good solution/pattern/method to use when using RIA to access a legacy data access layer and you want to use paging?

A: 

I assume you are using DomainDataSource on the client side for paging. It essentially just calls Skip and Take on the IQueryable. So my hunch is since you are always getting all customers with each call to GetCustomers, that each page operation will cause you to get all the customers each time. The DDS is assuming its call to Skip and Take will get composed into the LINQ query and ultimately made on the datasource itself.

Matt Greer