Large Data Sources: Server and Instant Feedback Modes
- 6 minutes to read
What are Server Modes?
In regular data binding modes, a data-aware control loads an entire data set at once, which, in cases of large data volumes, significantly slows down application startup and consumes a considerable amount of memory. The overall application performance depends on a user’s configuration, and data shaping operations (sorting, grouping, or filtering) may cause a bottleneck.
The primitive way to deal with this issue is to implement pagination, that is, to split a data set into discrete portions and display Previous and Next buttons, with page numbers in between, to switch between records. DevExpress Data Grid offers a more elegant solution that allows you to navigate between data portions on demand without any navigation buttons, and carry out all data shaping operations on the server side — Server Mode.
Server mode includes two separate modes:
- Regular (synchronous) server mode locks the GUI and does not respond to end-user actions when data is retrieved.
- Instant Feedback mode (asynchronous server mode) loads data in a background thread, so that the GUI remains responsive in the process. This mode is not supported in the GridLookUpEdit control.
Important
Since in both modes data shaping operations (filter, group, sort, etc.) are carried out on the server side, make sure the server supports these operations.
Server Mode Data Sources
To enable a specific server mode for your data-aware control, you need to use an appropriate data source. You can use data sources that ship as part of the eXpress Persistent Objects (XPO) library, or use dedicated data sources tailored to work with ‘LINQ to SQL Classes’.
The following table lists available Server Mode sources. All data sources except XPServerCollectionSource (with the enabled AllowEdit option) are read only.
Data Access Technology | Server Mode Data Source | Instant Feedback UI Data Source |
---|---|---|
Entity Framework 4+ | ||
XPO | ||
LINQ to SQL | ||
Parallel LINQ to Objects | ||
WCF Data Services | ||
OData v4 |
Note
Do not use the BindingSource
component to bind to data. Otherwise, all data is loaded into memory and Server Modes are rendered useless.
Infinite Scrolling - Virtual (Event-Based) Server Mode
In addition to the two “classic” data-on-demand Grid modes (Server Mode & Instant Feedback), you can use the event-based VirtualServerModeSource component to manually load large data volumes in small portions. This technique is called Infinite Scrolling. Infinite Scrolling successfully replaces data pagination used in data-aware controls from other vendors.
How to Implement Pagination - WinForms Data Grid
Feature Limitations and Specifics
In server mode, grid controls (GridControl, GridLookUpEdit, and SearchLookUpEdit) do not have simultaneous access to bound data in its entirety. This imposes certain limitations on the grid’s features that are available in a regular binding mode. Please see below for information on features that are not supported or recommended in server mode.
Non-supported Features
- Use of BindingSource for data binding.
- Master-detail mode.
- Adding/deleting records from the Grid Control when data is grouped.
- Sorting, grouping, and filtering data by display values, not by edit values (see the note below).
- Data searching in the Find Panel against columns whose data type is neither string nor numeric.
- Filtering rows using the ColumnView.CustomRowFilter event.
- Adding custom items to the Filter Dropdown list in Instant Feedback mode.
- Custom sorting using the ColumnView.CustomColumnSort event.
- Custom grouping using the GridView.CustomColumnGroup event.
- Merged grouping in all server-aware data sources, except for XPServerCollectionSource and XPInstantFeedbackSource.
- Group intervals (GridColumn.GroupInterval) when binding with WcfInstantFeedbackSource and WcfServerModeSource.
- Calculating custom summaries using the GridView.CustomSummaryCalculate event is limited: the event fires only once, when the
CustomSummaryProcess
parameter returns “Finalize”. - Sorting, grouping, filtering, and summary calculation for unbound columns whose values are supplied by the ColumnView.CustomUnboundColumnData event. These features are still supported for unbound columns that are populated using expressions (see GridColumn.UnboundExpression).
- Preserving the position of the focused row when data is grouped or sorted.
- Preserving row selection when data is sorted, grouped, or filtered (including Selection Binding).
- Composite keys when you use WcfInstantFeedbackSource and WcfServerModeSource.
- Binding to nested properties when you use Instant Feedback collections. To aggregate data from nested tables/objects, use XPInstantFeedbackView or projections with LINQ-based Instant Feedback collections (for example, LinqInstantFeedbackSource and EntityInstantFeedbackSource).
Note
Lookup columns can be bound to one data field but display text from another data field. Set the FieldNameSortGroup property to a data field with text values to sort lookup column values by display text in Server data binding modes.
General Specifics
When you use the Find Panel to search for data, the grid always converts a search string to lower case. Thus, when the Grid Control is bound to a case-sensitive data source, data search results do not contain target entries that have uppercase text.
You can overcome this issue by using a case-insensitive data source. See the following article to learn more: How to make the Grid’s filter case- and accent-insensitive in Server Mode.
- In Instant Feedback mode, the maximum number of visible data groups is limited to 10000.
- The server mode data source may be reloaded after changes to the underlying database. For instance, known scenarios include, but are not limited to: database changes caused by an external process, changes resulting from the code in the same process, in place editing, etc.
- Actions that involve operating on all Data Grid rows should be avoided since processing every row sends an individual query to a SQL server. Thus, performing such actions may cause severe performance issues and UI freezes. The actions that most negatively affect Data Grid performance are expanding all group rows (GridOptionsBehavior.AutoExpandAllGroups, GridView.ExpandAllGroups) and selecting all data records (GridView.SelectAll).
Entity Framework Specifics
To learn about known issues when using Entity Framework data sources in Server Mode and how to overcome them, please refer to Entity Framework 4.0+ Server Mode Specifics.
Examples
- Tutorial: Large Data Sources and Instant Feedback with Server Mode
- How to: Bind a GridControl to a Database in Server Mode
- How to: Reload Data from the Bound Database in Server Mode (XPO)
- How to: Implement CRUD operations (LinqServerModeSource)