- Automatically initialize CurrentObject in non-persistent detail views (Add/Instantiate NonPersistent Detail View in DashboardView). Provide the capability to show such a View from navigation without code.
- Support CRUD operations with non-persistent objects out of the box. It should be possible to make these operations using default XAF actions - CRUD operation for Non-persistent detailview in popupwindow. For this purpose, it should be possible to define a key property in a non-persistent class, and NonPersistentObjectSpace should be able to get values of these properties.
- NonPersistentObjectSpace - Support showing persistent objects in non-persistent objects' views
Core - Improve usability and support more scenarios of working with non-persistent objects
Answers approved by DevExpress Support
We have implemented the functionality described in this ticket. It will be included in our next update(s).
Please check back and leave a comment to this response to let us know whether or not this solution addresses your concerns.
The New, Delete and Save Actions are now available for non-persistent objects. Modified objects are accessible using the NonPersistentObjectSpace.ModifiedObjects property. This property provides access to all created, deleted and modified objects within NonPersistentObjectSpace, unless the CommitChanges, Refresh or Rollback methods are called.
An example is provided in the How to: Perform CRUD Operations with Non-Persistent Objects topic.
- v15.2.4Download Official Update
You do not need to do anything specific to support this functionality - it is sufficient to declare a collection property like this:
C#private BindingList<NonPersistentClass> _Collection;
public BindingList<NonPersistentClass> Collection {
get {
if (_Collection == null) {
_Collection = new BindingList<NonPersistentClass>();
}
return _Collection;
}
}
Hi Anatol
Thanks for the response. A couple of questions on what you supplied.
-
The generic type of BindingList would really be some other child class instead of NonPersistentClass, right?
-
Assuming #1 is right, and the child class was NonPersistentChildClass, would this child class need to implement the IObjectLink interface if it was being aggregated by the NonPersistentClass parent ? Or could you just create and add instances of the NonPersistentChildClass in the initializer code present in the WindowController descendant and everything just work?
Thanks
- You can use any non-persistent class there.
- Built-in actions can work without the IObjectSpaceLink interface. This interface allows you to access an IObjectSpace instance inside your business objects. It does not affect how XAF processes these objects.
See also:
ObjectSpace.ObjectChanged for nonpersistent classess / properties
Core - Introduce a capability to show a list of non-persistent objects created at runtime with easy