All docs
V21.2
21.2
21.1
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET 5.0+

NonPersistentObjectSpace.CustomGetObjectsQuery Event

Occurs when the GetObjectsQuery<T>(Boolean) method is executed.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v21.2.dll

Declaration

public event EventHandler<CustomGetObjectsQueryEventArgs> CustomGetObjectsQuery

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 platform-agnostic Module (the MySolution.Module project):

using DevExpress.ExpressApp;
using System.Collections.Generic;
using System.Linq;
// ...
public sealed partial class MySolutionModule : ModuleBase {
    // ...
    public override void Setup(XafApplication application) {
        base.Setup(application);
        application.ObjectSpaceCreated += Application_ObjectSpaceCreated;
    }
    private void Application_ObjectSpaceCreated(object sender, ObjectSpaceCreatedEventArgs e) {
        NonPersistentObjectSpace nonPersistentObjectSpace = e.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