Back to Devexpress

How to: Display a Non-Persistent Object's List View from the Navigation

expressappframework-114052-business-model-design-orm-non-persistent-objects-how-to-display-a-non-persistent-objects-list-view-from-the-navigation.md

latest2.6 KB
Original Source

How to: Display a Non-Persistent Object's List View from the Navigation

  • Apr 29, 2025
  • 3 minutes to read

This example demonstrates how to display a List View with non-persistent objects from the Navigation. Note that this approach is compatible with Client data access mode only.

  1. Declare a non-persistent class (for example, MyNonPersistentObject), and decorate it with the DomainComponent and DefaultClassOptions attributes.

  2. Open the application’s Startup.cs and ensure that the Non-Persistent Object Space Provider is registered in the Application Builder code. The Template Kit adds this code automatically.

  3. To fill the List View in code, subscribe to the OnObjectSpaceCreated event in the Application Builder code. In the event handler, subscribe to the NonPersistentObjectSpace.ObjectsGetting event. In the ObjectsGetting handler, check if the requested object type is MyNonPersistentObject and populate the e.Objects collection with new objects.

The image below demonstrates the result.

Tip

The New , Delete and Save Actions are available for non-persistent objects. To access all created, deleted and modified objects within NonPersistentObjectSpace, use the NonPersistentObjectSpace.ModifiedObjects property.

See Also

How to: Display a Non-Persistent Object's Detail View

How to: Display Non-Persistent Objects in a Report