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

Session.PreFetch<T>(IEnumerable<T>, String, IEnumerable) Method

Enforces loading data for associated collections.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v18.2.dll

Declaration

public void PreFetch<T>(
    IEnumerable<T> objects,
    string collectionInObjects,
    IEnumerable collectionsContent
)

Parameters

Name Type Description
objects IEnumerable<T>

An IEnumerable list of parent objects.

collectionInObjects String

A string which is the name of the associated collection property.

collectionsContent IEnumerable

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.

Type Parameters

Name
T

Remarks

By default, data is loaded automatically when you access a nested collection for the first time. When the PreFetch<T> method is called, all data for the specified collection is loaded at once. No additional SQL queries for this data will be will be performed later.

See Also