Programming Guide > Using ClientView in Code > Other Client View Operators |
Progressive loading
If you have a client view that is too big to load all entities at once without a delay, you can make it load incrementally, progressively, using the ProgressiveLoading method:
ProgressiveView<Product> moreResponsiveView = productsByCategory.ProgressiveLoading(p => p.ProductName, 100);
Here we intentionally used productsCategory (a FilteredView) instead of products, to show that any client view can be made progressive (except paging view where it does not make sense).
A progressive view loads data in portions, batches making data available on the client immediately after each portion has been loaded.
To create a progressive view, you need to specify the load size (100 in the example above) and a key selector by which to sort, because data must be sorted on the server to perform this kind of loading.
Include
Working with Entity Framework, you sometimes need to specify that related entities must be fetched together with your entity query. For example, querying for orders, you may want to get customer information for the orders to the client in the same query that fetches orders, to avoid fetching them one-by-one later (which is considerably slower than fetching all in one query). You can do this in Entity Framework by using the Include method of ObjectQuery. The same functionality is available in DataSource ClientView.Include method:
ClientView<Order> ordersWithCustomerInfo = orders.Include("Customer");