Skip to main content
.NET 6.0+

Session.GetObjectsByKeyAsync(XPClassInfo, ICollection, Boolean, CancellationToken) Method

Asynchronously returns reloaded persistent objects that have specified key property values from a data store.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v23.2.dll

NuGet Package: DevExpress.Xpo

Declaration

public Task<ICollection> GetObjectsByKeyAsync(
    XPClassInfo classInfo,
    ICollection idCollection,
    bool alwaysGetFromDataStore,
    CancellationToken cancellationToken = default(CancellationToken)
)

Parameters

Name Type Description
classInfo XPClassInfo

An XPClassInfo object that contains persistent class metadata.

idCollection ICollection

An object collection that represents a persistent object’s key property values.

alwaysGetFromDataStore Boolean

true, to always reload persistent objects from storage, even if they are found in memory; otherwise, false.

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<ICollection>

A Task that returns an array of object collections. Objects in these collections match specified query parameters.

Remarks

The GetObjectsByKeyAsync method searches in memory for persistent objects with specified key property values. If such objects are found, they are not reloaded. To get the up-to-date objects from storage, the alwaysGetFromDataStore parameter must be set to true.

Note

The GetObjectsByKeyAsync method does not find objects until they are saved to a data store.

See Also