Session.GetObjectsByKeyFromQuery(XPClassInfo, Boolean, String) Method
Returns reloaded persistent objects from a data store, with key property values obtained via the specified SQL query.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v18.2.dll
Declaration
public ICollection GetObjectsByKeyFromQuery(
XPClassInfo classInfo,
bool alwaysGetFromDataStore,
string sql
)
Parameters
Name | Type | Description |
---|---|---|
classInfo | XPClassInfo | An XPClassInfo object which contains the metadata information of the persistent objects that are retrieved, based on the query’s result set. |
alwaysGetFromDataStore | Boolean | true to reload persistent objects from storage, if they are found in memory; otherwise, false. |
sql | String | A String value that specifies a SQL query. |
Returns
Type | Description |
---|---|
ICollection | A collection of persistent objects with specified key property values. |
Remarks
First, the GetObjectsByKeyFromQuery method executes the specified SQL query and retrieves key property values into a result set. Then, the method searches in memory for persistent objects with retrieved key property values. If such objects are found, they are not reloaded. To get the up-to-date objects from storage, the alwaysGetFromDb parameter must be set to true.
Note
The GetObjectsByKeyFromQuery method does not find objects, until they are saved to a data store.
To learn more about executing SQL queries in XPO, refer to Direct SQL Queries.