Skip to main content
A newer version of this page is available. .

Session.PreFetchAsync(IEnumerable, XPMemberInfo, IEnumerable, CancellationToken) Method

Asynchronously forces associated collection data loading for specified parent objects.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v18.2.dll

Declaration

public Task PreFetchAsync(
    IEnumerable objects,
    XPMemberInfo collectionInObjects,
    IEnumerable collectionsContent,
    CancellationToken cancellationToken = default(CancellationToken)
)

Parameters

Name Type Description
objects IEnumerable

An IEnumerable list of parent objects.

collectionInObjects XPMemberInfo

An XPMemberInfo object that contains metadata information. This data specifies associated collection data to be retrieved.

collectionsContent IEnumerable

An IEnumerable list of the collection’s content. If a certain part of the collectionInObjects data was previously loaded, you can avoid reloading it by passing the loaded data to the collectionsContent parameter.

Optional Parameters

Name Type Default Description
cancellationToken CancellationToken *null*

A CancellationToken object that delivers a cancellation notice to the running operation.

Returns

Type Description
Task

A Task that forces associated collection data loading for specified parent objects.

Remarks

By default, data is loaded automatically when you access a persistent object’s nested collection for the first time. The PreFetchAsync loads all associated collection data for specified parent objects, before these collections are accessed. No additional SQL queries for this data will be will be performed later.

See Also