VerticalGridSettings.EnableRecordsCache Property
Gets or sets whether data caching is enabled.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.1.dll
NuGet Package: DevExpress.Web.Mvc5
Declaration
Property Value
Type | Description |
---|---|
Boolean | true, to enable data caching; otherwise, false. The default is false. |
Remarks
The VerticalGrid extension is able to store its data (the data of the current grid page) in memory for quick access. This might help avoid repeated database calls when performing various operations that don’t require reloading data (e.g., rearranging or hiding rows). For instance, this can be useful when the VerticalGrid is used in Database Server Mode - to reduce the number of database calls. To enable data caching, set the EnableRecordsCache option to true.
By default, data caching is disabled for the VerticalGrid. It is recommended that you leave the EnableRecordsCache property disabled in the following cases:
- The VerticalGrid displays real-time data.
- The VerticalGrid is bound to data created at runtime (because calling the Bind method always reloads data from the server).
- The VerticalGrid contains a BinaryImage row - a row whose MVCxVerticalGridRow.RowType property is set to MVCxVerticalGridRowType.BinaryImage (because preserving binary data in the record cache might dramatically increase the cache size and affect the application performance).
Note that the EnableRecordsCache option must be disabled when the VerticalGrid is used in Custom Data Binding mode.
Note
If you use custom objects that utilize a referenced association, the VerticalGrid tries to cache references as well. The serialization of a custom object is performed by the ToString method and is performed smoothly. But the object deserialization (restoration from String to object) could be raised with an exception:
TypeConverter cannot convert from System.String.
One solution is to turn off the EnableRecordsCache property. This solution is acceptable when the page doesn’t have several grids, and in most cases, doesn’t affect page performance significantly.
However, you can implement a custom TypeConverter derived class that can convert from the String type correctly. To learn more, see the Code Central example: How to implement a custom TypeConverter class for an XPO object