Back to Devexpress

BaseObjectSpace.SetPrefetchPropertyNames(Object, String[]) Method

expressappframework-devexpress-dot-expressapp-dot-baseobjectspace-dot-setprefetchpropertynames-x28-system-dot-object-system-dot-string-x29.md

latest2.6 KB
Original Source

BaseObjectSpace.SetPrefetchPropertyNames(Object, String[]) Method

Loads specified delayed properties and child collections in each object of a given list.

Namespace : DevExpress.ExpressApp

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
public virtual void SetPrefetchPropertyNames(
    object collection,
    params string[] propertyNames
)
vb
Public Overridable Sub SetPrefetchPropertyNames(
    collection As Object,
    ParamArray propertyNames As String()
)

Parameters

NameTypeDescription
collectionObject

An IEnumerable list of parent objects.

| | propertyNames | String[] |

Properties to load.

|

Remarks

Before a ListView is displayed, it may actively read properties of underlying data source items to calculate Conditional Appearance rules, actions’ TargetObjectsCriteria, or client-side filters. If filter conditions and appearance rules use Delayed Properties, call the SetPrefetchPropertyNames method before the ListView is opened to pre-load delayed properties and reduce a number of requiests to an underlying data source.

csharp
using DevExpress.ExpressApp;
// ...
public class PreFetchOrdersViewController : ObjectViewController<ListView, Customer> {
    protected override void OnActivated() {
        if(View.CollectionSource.DataAccessMode == CollectionSourceDataAccessMode.Client) {
            ((BaseObjectSpace)ObjectSpace).SetPrefetchPropertyNames(View.CollectionSource.Collection, nameof(Customer.Orders));
        }
    }
}

See Also

BaseObjectSpace Class

BaseObjectSpace Members

DevExpress.ExpressApp Namespace