Large Data Sources: Server and Instant Feedback Modes
- 5 minutes to read
- What are Server Modes?
- Feature Limitations and Specifics
- Server Mode Data Sources
- Infinite Scrolling - Virtual (Event-Based) Server Mode
- Data Stores Supported in Server Mode When Using XPO
- Server Mode: Binding to a Data Source Using XPO
Demos (links require the DevExpress Demo Center of version 16.2 or newer to be installed)
- 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)
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 customer's rig, 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, page numbers and Next buttons 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 Modes.
The "server modes" term includes two separate modes:
- a regular (synchronous) server mode locks the GUI and does not respond to end-users' actions when data is retrieved;
- an 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.
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.
Feature Limitations and Specifics
In server modes, 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 still available in a regular binding mode. Please see below for information on features that are not supported/not recommended in server mode.
- 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 displayed values (not by editing values).
- 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
CustomSummaryProcessparameter returns "Finalize".
Sorting, grouping, filtering and summary calculation for unbound columns whose values are provided with 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.
- Compound 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 (e.g., LinqInstantFeedbackSource and EntityInstantFeedbackSource).
When you search via the Find Panel, 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 text in upper case.
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.
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 provided by the eXpress Persistent Objects (XPO) library, or use dedicated data sources tailored to work with 'LINQ to SQL Classes'. Thus, choose one of the following data sources for your control.
Data Access Technology
Server Mode Data Source
Instant Feedback UI Data Source
Entity Framework 4+
LINQ to SQL
Parallel LINQ to Objects
WCF Data Services
Note that you should bind to data without the BindingSource component. Otherwise, all data is loaded into memory and Server Modes are rendered useless.
Infinite Scrolling - Virtual (Event-Based) Server Mode
In addition to 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, and it successfully replaces data pagination used in data-aware controls from other vendors.