DataView Mode
- 3 minutes to read
#Mode Overview
The DataView mode improves List View performance by retrieving an XafDataView lightweight read-only list of data records at once, instead of loading an XPCollection or DevExpress.ExpressApp.EFCore.EFCoreCollection of persistent objects.
#Expected Behavior
- The ListView.CurrentObject, ListView.SelectedObjects and SimpleActionExecuteEventArgs.SelectedObjects properties return the XpoDataViewRecord or DevExpress.ExpressApp.EFCore.EFCoreDataViewRecord objects instead of original business objects. To get the real object, use the IObjectSpace.GetObject method.
- Data for non-persistent properties does not show in List Views operating in DataView mode. However, custom calculated fields are correctly displayed in this mode if all properties referenced in IModelMember.Expression are persistent.
Inline editing is not supported in this mode. 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 a 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).
Also, if the Appearance and Security rules are applied to an object type in the current List View, and those criteria use objects’ properties that are not contained in the CollectionSourceBase.DisplayableProperties collection, these objects’ instances are created by the separate database request to check each rule.
- Reference properties cannot be displayed in the DataView mode. The List Editor automatically replaces reference properties with their default nested properties (which can be defined using the XafDefaultPropertyAttribute attribute) when retrieving data. For instance, in the Employee List View, the Employee.Department property is replaced with Employee.Department.Title.
- The DataView mode is currently supported by a number of built-in List Editors - the GridListEditor, SchedulerListEditor, PivotGridListEditor used in WinForms applications, and the ASPxGridListEditor, ASPxSchedulerListEditor, ASPxPivotGridListEditor used in ASP.NET Web Forms applications.
- The SchedulerListEditor and ASPxSchedulerListEditor editors do not support Resources in this mode.
- In nested List Views, the Link, Unlink, New, Delete and Edit Actions are disabled by design.
- The OpenObjectController.OpenObject Action is inactive in this mode.
- Using invisible properties in criteria evaluation is processed correctly, but it may have a negative performance impact because it leads to loading real objects through separate database requests. Using collection properties can cause much more recursive requests. Consider using the Client Mode instead of DataView mode if you cannot avoid using such criteria because there is no difference in performance.
Note
If you use the EF Core as your ORM system, 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.