Server, ServerView, InstantFeedback, and InstantFeedbackView Modes
- 6 minutes to read
This article extends the List View Data Access Modes topic and details Server, ServerView, InstantFeedback, and InstantFeedbackView modes behavior.
Notes on All Modes
- All these modes support XPO and EF Core ORMs.
- A List View does not have simultaneous access to all objects of the ListView.CollectionSource type. Only those objects that are currently visible are loaded in small portions on demand. Each operation that assumes that new visible objects will appear (scrolling, paging, grouping, sorting) requires additional data requests.
- If you have a custom Controller that accesses the List Editor’s control in a List View to execute custom sorting or grouping, the Controller may no longer work, since the database server executes grouping and sorting. Custom summaries are also calculated on the server side.
- In ServerView, InstantFeedbackView, and DataView modes, List Editors do not display non-persistent property values. To show them, apply the DevExpress.Xpo.PersistentAliasAttribute (XPO) or DevExpress.ExpressApp.DC.PersistentAliasAttribute (EF Core) to these properties.
- List Editors do not support filter, sort, and group operations for non-persistent properties. To enable these operations, apply the DevExpress.Xpo.PersistentAliasAttribute (XPO) or DevExpress.ExpressApp.DC.PersistentAliasAttribute (EF Core) to these properties.
Inline editing is not supported in ServerView, InstantFeedback, and InstantFeedbackView modes. If an original object was modified, it is not displayed in a List View until you commit changes and reload the collection.
For example, when an Action changes an object’s property value, this object’s instance is created by the separate database request and the property value’s modification is not applied to the grid until you commit changes (or it occurs automatically if the BaseObjectSpace.CommitChanges property is set to true).
Controls that support these modes do not have full access to underlying data and cannot initiate filter, sort, and group operations on the client side. These operations are delegated to the underlying ORM (EF Core or XPO), which constructs an appropriate SQL statement and sends a query to the SQL server to retrieve a small portion of data that should immediately be displayed to the user. You cannot filter, sort, or group data against non-persistent properties – it is not possible to build a SQL query against a runtime value that exists on the client side only, and execute it on the database server side. Filter, group, and sort operations are disabled if a property is non-persistent.
- If you want one of these modes to display a nested List View, make sure that there is no logic for sorting, filtering or anything else in the getter of the underlying collection, and there are no subscribers to the collection’s events. This logic and subscribers will not be taken into account, because a standalone server collection will be created instead of the original collection.
An independent server-mode collection is created as a data source for a lookup ListView when the IModelListView.DataAccessMode option is set to Server, ServerView, InstantFeedback, or InstantFeedbackView for that ListView model. However, when the DataSourcePropertyAttribute is applied for the lookup property, the property pointed in the attribute is used as a lookup data source, and the standalone independent server-mode collection is not created and is not used at all. The reason is that the data source property getter contains logic calculated on the client side and the data source is populated by the client application at the moment when the lookup editor requests to display objects. So, the Server, ServerView, InstantFeedback, or InstantFeedbackView mode option and the DataSourceProperty attribute do not work simultaneously.
- If you use a legacy database whose table has a primary compound key, such a table cannot be used to supply data in Server, ServerView, InstantFeedback, and InstantFeedbackView mode.
- The OpenObjectController.OpenObject Action is inactive in the ServerView, InstantFeedback, and InstantFeedbackView modes.
Notes on Server and ServerView Modes
- The Server mode supports in-place editing.
- The following built-in List Editors currently support the Server mode: GridListEditor (WinForms), DxGridListEditor (ASP.NET Core Blazor), and ASPxGridListEditor (ASP.NET Web Forms). The ServerView mode is compatible with the WinForms GridListEditor and Blazor DxGridListEditor.
- In the ServerView mode, the View.CurrentObject and View.SelectedObjects properties return ObjectRecord objects instead of original business objects. To get the real object, use the IObjectSpace.GetObject method.
- Data-aware operations (grouping, sorting, etc.) are performed synchronously by the database server and significantly increase the List View’s performance when working with many objects. In these modes, all properties are calculated when it is required (only the visible properties in the GridView and properties that are used in the Appearance, Security rules, etc., are calculated).
Tip
ServerView is the fastest synchronous data access mode.
Notes on InstantFeedback and InstantFeedbackView Modes
- These modes are compatible with the WinForms GridListEditor and Blazor DxGridListEditor. These editors are used in the default configuration.
- The View.CurrentObject and View.SelectedObjects properties return ObjectRecord objects instead of original business objects. To get the real object, use the IObjectSpace.GetObject method.
- Data-aware operations are performed asynchronously in a background thread, and the control continues to respond to the user’s actions while data is being retrieved.
- In the InstantFeedback mode, you can implement custom logic in the OnLoading() or AfterConstruction() method.
- In XPO, the CollectionSourceBase.DisplayableProperties collection contains names of all visible properties and properties listed in XPInstantFeedbackSource.DisplayableProperties. Properties that are hidden in the UI but are listed in CollectionSourceBase.DisplayableProperties may have complicated logic in getters, which require a large number of database requests. This behavior may cause performance issues. You can change the default behavior using the XPObjectSpace.InstantFeedbackMappingMode property.
- In EF Core, the CollectionSourceBase.DisplayableProperties collection contains names of visible properties only.
- A List View makes additional database requests if an Appearance/Security rule or PersistentAlias/Calculated attribute’s expression uses properties that are not in the CollectionSourceBase.DisplayableProperties collection. To avoid excess requests, add these properties to CollectionSourceBase.DisplayableProperties. You can access all properties listed in this collection without additional requests.
- Reference properties are automatically replaced by default properties of the corresponding reference objects when sorting, grouping, and filtering. For instance, in the Contact List View, the Contact.Department.Title property is used instead of Contact.Department.
- If you use EF Core as your ORM system and InstantFeedback as the data access mode, you can implement cascade deletion of Aggregated collections as described in the Cascade Deletion for Aggregated Entities section of the Relationships Between Entities in Code and UI help topic.
Tip
InstantFeedbackView is the fastest asynchronous data access mode.