Session.GetObjectByKeyAsync(XPClassInfo, Object, Boolean, CancellationToken) Method
Asynchronously returns a persistent object that has the specified key property value from a data store.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v18.2.dll
Declaration
public Task<object> GetObjectByKeyAsync(
XPClassInfo classInfo,
object id,
bool alwaysGetFromDataStore,
CancellationToken cancellationToken = default(CancellationToken)
)
Parameters
Name | Type | Description |
---|---|---|
classInfo | XPClassInfo | An XPClassInfo object which contains the metadata information of the class. |
id | Object | An object which represents the key property’s value of the persistent object. |
alwaysGetFromDataStore | Boolean | true, to always reload the persistent object from storage even if it is 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<Object> | A Task that returns a persistent object from a data store. This persistent object has the specified key property value. |
Remarks
The GetObjectByKeyAsync method searches in memory for the object with the specified key property value. If such an object is found, it is not reloaded. To get the up-to-date object from storage the alwaysGetFromDataStore parameter must be set to true.