Skip to main content
.NET 6.0+

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.v24.1.dll

NuGet Package: DevExpress.ExpressApp

Declaration

public virtual void SetPrefetchPropertyNames(
    object collection,
    params string[] propertyNames
)

Parameters

Name Type Description
collection Object

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.

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