Skip to content

DevExpress-Examples/XAF-How-to-Implement-CRUD-Operations-for-Non-Persistent-Objects-Stored-Remotely

 
 

Repository files navigation

XAF - How to Implement CRUD Operations for Non-Persistent Objects Stored Remotely

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.

Implementation Details

This example uses NonPersistentObjectSpace members.

Non-persistent objects are kept in an object map. XAF uses event handlers to manage these objects.

  1. To look up non-persistent objects and add them to the object map:

  2. To clear the object map:

    • Reloaded

      Subsequent object queries trigger the creation of new non-persistent object instances.

  3. To reload the state of an existing object from storage:

  4. 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.

Common Components

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) for NonPersistentObjectSpace.

  • 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.

Files to Review

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

How to implement CRUD operations for remotely stored non-persistent objects in XAF applications.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 76.1%
  • HTML 22.5%
  • CSS 1.1%
  • Batchfile 0.3%