Skip to content

Latest commit

 

History

History
49 lines (35 loc) · 6.2 KB

File metadata and controls

49 lines (35 loc) · 6.2 KB

XAF - How to edit a collection of persistent objects linked to a non-persistent object

When a non-persistent object contains a collection of persistent business objects, you may need to edit linked objects right in the list view either in in-place or in ListViewAndDetailView mode. Also, if a linked persistent object is edited in a popup detail view, you may need to see changes in the source list view after they are saved.

This example demonstrates how you can perform these tasks in XAF applications.

Warning

We created this example for demonstration purposes and it is not intended to address all possible usage scenarios. If this example does not have certain functionality or you want to change its behavior, you can extend this example. This can be a complex task that requires good knowledge of XAF: UI Customization Categories by Skill Level, and you may need to research how our components work. Refer to the following help topic for more information: Debug DevExpress .NET Source Code with PDB Symbols. We are unable to help with such tasks as custom programming is outside our Support Service scope: Technical Support Scope.

Implementation Details

  1. 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 of.
  2. Set NonPersistentObjectSpace.AutoCommitAdditionalObjectSpaces to true to automatically commit changes made to linked persistent objects.
  3. Set NonPersistentObjectSpace.AutoRefreshAdditionalObjectSpaces to true and subscribe to the ObjectGetting event, to refresh linked persistent objects when the non-persistent object view is refreshed. In the event handler, create a new instance of the non-persistent object and get fresh copies of linked persistent objects.
  4. This example uses the Category property to filter the nested list view of persistent objects. To avoid the object space modification when this property is changed, subscribe to the BaseObjectSpace.ModifiedChanging event and set the e.Cancel parameter to true depending on other event arguments.

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)