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)?
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.