Asynchronous Virtual Source
- 2 minutes to read
Overview
The InfiniteAsyncSource is an asynchronous virtual source that allows you to bind the GridControl to any data source even if the total record count is unknown. You can create solutions that remain responsive to end-user actions regardless of the demands placed upon the Grid. Whenever you work with a large dataset, InfiniteAsyncSource fetches and processes data on-demand, in a background thread. This ensures that the Grid does not freeze during data-intensive operations.
Use the InfiniteAsyncSource in the following cases:
- A data source supports asynchrony (for example, .NET MongoDB Driver provides methods to perform multiple requests at the same time).
- You can create a new data access object (for example, DbContext) for every request.
The Virtual Source Limitations topic lists features that are not available or require additional actions to be enabled.
The Binding to InfiniteAsyncSource tutorial describes how to use the InfiniteAsyncSource.
Workflow
The InfiniteAsyncSource raises events in the UI Thread and processes data in parallel working threads. You have to provide tasks to these events to obtain summaries, rows, etc.
The image below illustrates the workflow.
- The virtual source raises the InfiniteAsyncSource.GetTotalSummaries event. Handle this event and process summaries if you want to show them in the GridControl.
- The virtual source raises the InfiniteAsyncSource.FetchRows event to get the first portion of data.
- When end-users scroll the grid, the virtual source raises the InfiniteAsyncSource.FetchRows event to get the next portion of data.
- When end-users apply a filter, the virtual source raises the InfiniteAsyncSource.GetUniqueValues event to get unique values and show them in a drop-down filter.