.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

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

Enforces loading data for associated collections and delayed properties.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v20.1.dll


public void PreFetch<T>(
    IEnumerable<T> objects,
    params string[] propertyPaths
    where T : class
Public Sub PreFetch(Of T As Class)(
    objects As IEnumerable(Of T),
    ParamArray propertyPaths As String()


Name Type Description
objects IEnumerable<T>

An IEnumerable list of parent objects.

propertyPaths String[]

An array of strings that are the collection property and delayed property names, or property paths (e.g, "ChildCollection.AnotherChildCollection").

Type Parameters



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

using DevExpress.Xpo;
using DevExpress.Xpo.Metadata;
// ...
XPCollection<Person> people = new XPCollection<Person>(session);
session.PreFetch<Person>(people, nameof(PhoneNumbers));
See Also