Skip to content

DevExpress-Examples/XAF_Non-Persistent-Objects-Edit-Linked-Persistent-Objects-Demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Files to look at:

How to edit a collection of Persistent Objects linked to a Non-Persistent Object

Scenario

When a Non-Persistent Object contains a collection of persistent business objects, we want to edit linked objects right in the list view either in in-place mode or in ListViewAndDetailView mode. Also, when a linked persistent object is edited in a popup detail view, we want to see changes in the source list view after they are saved.

Solution

The NonPersistentObjectSpace created for the master object cannot handle linked persistent objects by default. To work with them, create a persistent object space and add it to the AdditionalObjectSpaces collection. Set NonPersistentObjectSpace.AutoDisposeAdditionalObjectSpaces to true to automatically dispose of additional object spaces when the master is disposed.

To automatically commit changes made to linked persistent objects, set NonPersistentObjectSpace.AutoCommitAdditionalObjectSpaces to true.

To refresh linked persistent objects when the non-persistent object view is refreshed, set NonPersistentObjectSpace.AutoRefreshAdditionalObjectSpaces to true and subscribe to the ObjectGetting event. In the event handler, create a new non-persistent object instance and get fresh copies of linked persistent objects.

The Category property in this example is used to filter the nested list view of persistent objects. To avoid modifying the object space when this property is changed, subscribe to the BaseObjectSpace.ModifiedChanging event and set the e.Cancel parameter to true depending on other event arguments.

Releases

No releases published

Packages

No packages published

Languages

  • C# 75.2%
  • HTML 23.7%
  • CSS 1.1%