The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Session.PreFetch(XPClassInfo, IEnumerable, String[]) Method

Enforces loading data for associated collections and delayed properties.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v19.2.dll

Declaration

public void PreFetch(
    XPClassInfo classInfo,
    IEnumerable objects,
    params string[] propertyPaths
)
Public Sub PreFetch(
    classInfo As XPClassInfo,
    objects As IEnumerable,
    ParamArray propertyPaths As String()
)
public void PreFetch(
    XPClassInfo classInfo,
    IEnumerable objects,
    params string[] propertyPaths
)
Public Sub PreFetch(
    classInfo As XPClassInfo,
    objects As IEnumerable,
    ParamArray propertyPaths As String()
)

Parameters

Name Type Description
classInfo XPClassInfo

An XPClassInfo object that provides metadata information for a parent class.

objects IEnumerable

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").

Parameters

Name Type Description
classInfo XPClassInfo

An XPClassInfo object that provides metadata information for a parent class.

objects IEnumerable

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").

Remarks

By default, data is loaded automatically when you access a nested collection or delayed property for the first time. When the PreFetch 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;
// ...
XPCollection<Person> people = new XPCollection<Person>(session);
session.PreFetch(session.GetClassInfo<Person>(), people, nameof(PhoneNumbers));
See Also