This example demonstrates an implementation of editable non-persistent objects that represent data stored remotely and separately from the main XAF application database. You can create, modify, and delete these non-persistent objects. The changes are persisted in the external storage. The built-in IsNewObject
function is used in the Appearance rule criterion that disables the key property editor after a non-persistent object is saved.
This example uses NonPersistentObjectSpace members.
Non-persistent objects are kept in an object map. XAF uses event handlers to manage these objects.
-
To look up non-persistent objects and add them to the object map:
-
To clear the object map:
-
Subsequent object queries trigger the creation of new non-persistent object instances.
-
-
To reload the state of an existing object from storage:
-
To process all object changes and pass them to storage:
The NonPersistentObjectSpace.AutoSetModifiedOnObjectChange property is set to true
to automatically mark non-persistent objects as modified when XAF raises the INotifyPropertyChanged.PropertyChanged
event.
List<T>
objects store non-persistent data.
The following classes are used to provide a common functionality for all non-persistent objects used in the demo.
-
TransientNonPersistentObjectAdapter
The adapter for transient (short-living) non-persistent business objects. Such objects exist only during the lifespan of their object space. A new adapter instance is created for each non-persistent object space. It subscribes to object space events to manage a subset of object types in a common manner. It also maintains an identity map (ObjectMap
) forNonPersistentObjectSpace
. -
NonPersistentStorageBase
Descendants of this class know how to create object instances and transfer data between objects and the storage. They know nothing about the adapter. They also use the identity map to avoid creating duplicated objects.
- How to implement CRUD operations for Non-Persistent Objects stored remotely in eXpressApp Framework
- How to edit Non-Persistent Objects nested in a Persistent Object
- How to: Display a List of Non-Persistent Objects
- How to filter and sort Non-Persistent Objects
- How to refresh Non-Persistent Objects and reload nested Persistent Objects
- How to edit a collection of Persistent Objects linked to a Non-Persistent Object
(you will be redirected to DevExpress.com to submit your response)