NonPersistentObjectSpace.CustomGetObjectsQuery Event
Occurs when the GetObjectsQuery<T>(Boolean) method is executed.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v24.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Event Data
The CustomGetObjectsQuery event's data class is DevExpress.ExpressApp.CustomGetObjectsQueryEventArgs.
Remarks
Handle this event to pass a custom strongly-typed query of non-persistent objects to the GetObjectsQuery<T>(Boolean) method. The following example shows how to handle this event in the Application Builder code:
File: MySolution.Blazor.Server/Startup.cs, MySolution.Win/Startup.cs, MySolution.WebApi/Startup.cs
using DevExpress.ExpressApp;
// ...
builder.ObjectSpaceProviders.Events.OnObjectSpaceCreated = context => {
NonPersistentObjectSpace nonPersistentObjectSpace = context.ObjectSpace as NonPersistentObjectSpace;
if (nonPersistentObjectSpace != null) {
nonPersistentObjectSpace.CustomGetObjectsQuery += NonPersistentObjectSpace_CustomGetObjectsQuery;
//...
}
};
// ...
List<Article> articles;
private void NonPersistentObjectSpace_CustomGetObjectsQuery(object sender, CustomGetObjectsQueryEventArgs e) {
if (typeof(Article).IsAssignableFrom(e.ObjectType)) {
e.Queryable = articles.AsQueryable();
}
}
See Also