Server, ServerView, InstantFeedback, and InstantFeedbackView Modes
This article extends the List View Data Access Modes topic and details Server, ServerView, InstantFeedback, and InstantFeedbackView modes behavior.
- All these modes support eXpress Persistent Objects (XPO), the Server and InstantFeedback modes also support Entity Framework (EF).
- A List View does not have simultaneous access to all the objects of the ListView.CollectionSource's type. Only those objects that are currently visible are loaded in small portions on demand. Each operation that assumes that new visible objects appear (scrolling, paging, grouping, sorting), requires additional data requests.
- If you have a custom Controller that accesses the List Editor's control of a List View to perform custom sorting or grouping, the Controller may no longer work, since the database server performs grouping and sorting. Custom summaries are also calculated on the server side.
- In ServerView and InstantFeedbackView modes, List Editors do not display non-persistent property values. To show them, apply PersistentAliasAttribute to these properties.
- List Editors do not support the filter, sort, and group operations with non-persistent properties. To enable these operations, apply the PersistentAlias (XPO) or CalculatedAttribute (EF) attribute to these properties.
Inline editing is not supported in ServerView, InstantFeedback, and InstantFeedbackView modes. If an original object was modified, it does not display 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 displayed on a 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 the filtering, sorting and grouping operations on the client side. These operations are delegated to the underlying ORM (Entity Framework or XPO), which constructs an appropriate SQL statement and performs a query to the SQL server to retrieve a small portion of data that should immediately display to the user. You cannot filter, sort and group data against non-persistent properties - it is not possible to build a SQL query against a runtime value existing on the client side only, and execute it on the database server. Filtering, grouping and sorting 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 won't 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.
Server and ServerView Modes Specificities
- The Server mode supports in-place editing.
- Two built-in List Editors currently support the Server mode: the GridListEditor, used by default in WinForms applications, and the ASPxGridListEditor, used by default in ASP.NET Web applications. The ServerView mode is compatible with the WinForms GridListEditor only.
- 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 increases the List View's performance when working with a large number of objects. In these modes, all properties are calculated when it is required (only the visible in the GridView and that is used in the Appearance, Security rules, etc).
ServerView is the fastest synchronous data access mode.
InstantFeedback and InstantFeedbackView Modes Specificities
- These modes are compatible only with the WinForms GridListEditor, used by default in WinForms applications.
- 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.
- The data-aware operations are performed asynchronously in the background thread, and the control continues responding to a 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 which are hidden in the UI but are listed in CollectionSourceBase.DisplayableProperties may have complicated logic in getters which requires a large amount of database requests. This behavior may cause performance issues. You can change the default behavior using the XPObjectSpace.InstantFeedbackMappingMode property.
- In EF, 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 the Entity Framework as your ORM system and InstantFeedback data access mode, implement Aggregated collections' cascade deletion as described in the Cascade Deletion for Aggregated Entities section of the Relationships Between Entities in Code and UI topic.
InstantFeedbackView is the fastest asynchronous data access mode.