Current filter:
                                You should refresh the page.
                                  • Hi,

                                    I'm trying to do the following:
                                    * Have an IList property in a BO (let's call the property "List")
                                    * Decorate this List property with a custom ValueConverter, which will serialize the List as XML to the database. The actual object in the IList is called StringValue and is a non persistent class, only to hold a string value.
                                    * the custom value converter will serialize the string value into a List<string> and serialize that. Upon deserialization, it re-creates the List<StringValue> again.

                                    It almost works perfectly. The serialization and deserialization works just fine. I.e. If I create a in instance of IList<StringValue> in AfterConstruction() and populate it with some values, it is serialized properly to the database upon saving the BO.

                                    The problem I have is that the list editor that is shown in the detail view does not have any new, delete or edit actions. I believe this is because there is no association attribute set but I cannot use this attribute since the referenced class (StringValue) is non persistent. I simply want the list to be "Aggregated" but using that attribute doesn't help neither.

                                    What are the options to get this to work? I presume creating a custom list editor is possible but it seems like quite a bit of work (I'd need it for both winforms and web). Or is there an appropriate pre-defined editor I can use (i.e. a simple list view editor with the "new", "delete" and "edit" actions in a toolbar)?

                                    Regards,
                                    Hans

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Hans,

                                This functionality is not available, because StringValue objects are non-persistent, while they are shown through a persistent Object Space (the master object's Object Space). Persistent Object Spaces cannot create or delete non-persistent objects. For this purpose, we provide the NonPersistentObjectSpace class - see Non-Persistent Objects. However, you need to change your configuration to use this class in this case. Instead of displaying StringValue objects through ListPropertyEditor that uses the parent DetailView's Object Space, display them through a DashboardViewItem that has its own Object Space (see How to: Display Several Views Side-by-Side). To learn how to provide data for this DashboardViewItem and synchronize it with the master object's DetailView, refer to the following articles:

                                How to: Perform CRUD Operations with Non-Persistent Objects
                                How to implement dependent views in a DashboardView (filter based on selection)
                                How to access a nested ListView from the parent DetailView's controller and parent DetailView from the nested ListView's controller

                                Please feel free to contact us if you encounter any difficulty.

                                • Hans Rutstrom 05.04.2017

                                  Hi Anatol,

                                  Thanks for your suggestion. I'm not sure I fully understand though, or perhaps I'm misunderstanding. If I do it this way, by using NonPersistentObjectSpace and a DashboardViewItem, how can I link it to the master object only? I would like it to behave as if it is part of (aggregated) the master object, not as a separate collection which is linked manually by the user (this also doesn't work in my tests, there is nothing in the lookup list for the non persistent object).

                                  I did try, and I can display the list of non persistent objects (With add/delete/edit etc). However, the examples only show how to have a static list of all values for the non persistent objects loaded in to the NonPersistentObjectSpace. I do not really understand how I can load the NonPersistentObjectSpace only with those values (which are de-serialized) from the master object that the detail view is opened for (i.e. the CurrentObject in that view). There is from what I can see no link and no possible way for me to retrieve that object in the controller managing the NonPersistentObjectSpace.

                                  I also could not get this to work by applying a criteria in the DashboardViewItem (in the model editor). I don't know if I'm misunderstanding this as well but I thought I could pass in a reference to the current master object this way(or at least the Oid). However, in the NonPersistentObjectSpace.ObjectsGetting eventhandler, the ObjectsGettingEventArgs.Criteria is always empty.

                                • Anatol (DevExpress Support) 05.04.2017

                                  You can access the master object from a ViewController of your non-persistent ListView using the ((NestedFrame)Frame).ViewItem.CurrentObject property, as shown in the How to access a nested ListView from the parent DetailView's controller and parent DetailView from the nested ListView's controller example. The ObjectsGetting event will likely be already raised at this moment, so you will need to re-raise it by calling the ListView.CollectionSource.ResetCollection method. Let me know if you need further assistance with this solution.

                                • Hans Rutstrom 05.05.2017

                                  Thanks Anatol. I'll have a look at this.